Structured Search Queries Based on Social-Graph Information

ABSTRACT

In particular embodiments, a method includes receiving an unstructured text query, identifying nodes and edges from a social graph that correspond to n-grams in the text query, and then generating structured queries that include references to the identified nodes and edges.

RELATED APPLICATIONS

This application is a continuation-in-part under 35 U.S.C. §120 of U.S.patent application Ser. No. 12/763,162, filed 19 Apr. 2010, which isincorporated by reference.

TECHNICAL FIELD

This disclosure generally relates to social graphs and performingsearches for objects within a social-networking environment.

BACKGROUND

A social-networking system, such as a social-networking website, enablesits users to interact with it and with each other through the system.The social-networking system may create and store a record, oftenreferred to as a user profile, in connection with the user. The userprofile may include a user's contact information, backgroundinformation, employment information, demographic information,communication channel information, personal interests, or other suitableinformation. The social-networking system may also create and store arecord of a user's relationship with other users in thesocial-networking system (e.g., social graph), as well as provideservices (e.g., wall-posts, photo-sharing, event organization,messaging, games, or advertisements) to facilitate social interactionbetween users in the social-networking system. The social-networkingsystem may store a social graph, where individuals, groups, entities, ororganizations are represented as nodes in the graph, and where the nodesare connected by edges that may represent one or more specific types ofinterdependency. The social-networking system may transmit content andmessages related to its services to a user's client device over anetwork.

Social-graph analysis views social relationships in terms of networktheory consisting of nodes and edges. Nodes represent the individualactors within the networks, and edges represent the relationshipsbetween the actors. The resulting graph-based structures are often verycomplex. There can be many types of nodes and many types of edges forconnecting nodes. In its simplest form, a social graph is a map of allof the relevant edges between all the nodes being studied.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 illustrates an example network environment network environment100 for implementing a social-networking system.

FIG. 2A illustrates example components of an example social-networkingsystem.

FIG. 2B illustrates an example architecture of the examplesocial-networking system and an example architecture of an exampleclient device.

FIG. 3 illustrates an example social graph.

FIGS. 4A-4D illustrate example user-profile pages.

FIGS. 5A-5C illustrate example concept-profile pages.

FIGS. 6A-6R illustrate example queries of the social network.

FIG. 7 illustrates an example method for detecting social graph elementsfor structured search queries.

FIG. 8 illustrates an example method for generating personalizedstructured search queries.

FIG. 9 illustrates an example method for generating structured queriesbased on social-graph information.

FIG. 10 illustrates an example social graph.

FIGS. 11A-11C illustrate example sub-graphs for resolving privacysettings.

FIG. 12 illustrates an example method for filtering the search resultsfor a structured search query based on privacy settings.

FIG. 13 illustrates an example computer system.

FIG. 14 illustrates an example network environment.

DESCRIPTION OF EXAMPLE EMBODIMENTS System Overview

FIG. 1 illustrates an example network environment 100 for implementing asocial-networking system. The various example embodiments describedherein may operate in network environment 100. Particular embodimentsmay operate in, or in conjunction with, a wide-area network environment,such as the Internet, including multiple network addressable systems.Network environment 100 may include a social-networking system 20, aclient device 30, a web-application server 40, and an enterprise server50 connected to each other by a network cloud 60. Although FIG. 1illustrates a particular arrangement of social-networking system 20,client device 30, web-application server 40, enterprise server 50, andnetwork cloud 60, this disclosure contemplates any suitable arrangementof social-networking system 20, client device 30, web-application server40, enterprise server 50, and network cloud 60. As an example and not byway of limitation, two or more of social-networking system 20, clientdevice 30, web-application server 40, and enterprise server 50 may beconnected to each other directly, bypassing network cloud 60. As anotherexample, two or more of social-networking system 20, client device 30,web-application server 40, and enterprise server 50 may be physically orlogically co-located with each other in whole or in part. Moreover,although FIG. 1 illustrates a particular number of social-networkingsystems 20, client devices 30, web-application servers 40, enterpriseservers 50, and network clouds 60, this disclosure contemplates anysuitable number of social-networking systems 20, client devices 30,web-application servers 40, enterprise servers 50, and network clouds60. As an example and not by way of limitation, network environment 100may include multiple social-networking systems 20, client device 30,web-application servers 40, enterprise servers 50, and network clouds60.

In particular embodiments, web-application server 40 may be anetwork-addressable computing system that can host third-party websites(e.g., http://www.espn.com, http://www.youtube.com). Web-applicationserver 40 may generate, store, receive, and transmit, for example, userdata and webpage information. Web-application server 40 may be accessedby the other components of network environment 100 either directly orvia network cloud 60. In particular embodiments, enterprise server 50may be a network-addressable computing system that can host one or moreenterprise systems. Enterprise server 50 may generate, store, receive,and transmit any suitable enterprise data. Enterprise server 50 may beaccessed by the other components of network environment 100 eitherdirectly or via network cloud 60.

In particular embodiments, a user may use one or more client devices 30to access, send data to, and receive data from social-networking system20 or web-application server 40. Client device 30 may accesssocial-networking system 20 or web-application server 40 directly, vianetwork cloud 60, or via a third-party system. As an example and not byway of limitation, client device 30 may access web-application server 40or enterprise server 50 via social-networking system 20. Client device30 may be any suitable computing device, such as, for example, apersonal computer, a laptop, a cellular phone, a smart phone or othercellular or mobile device, a personal digital assistant, an in- orout-of-car navigation system, a mobile gaming device, or a computingtablet.

In particular embodiments, network cloud 60 may include one or moreinterconnected networks over which various systems and hosts describedherein may communicate. This disclosure contemplates any suitablenetwork cloud 60. As an example and not by way of limitation, one ormore portions of network cloud 60 may include an ad hoc network, anintranet, a private network, an extranet, a virtual private network(VPN), a local area network (LAN), a wireless network, a wireless LAN(WLAN), a wide area network (WAN), a wireless WAN (WWAN), a metropolitanarea network (MAN), a portion of the Internet, a packet-based wide-areanetwork, a portion of the Public Switched Telephone Network (PSTN), acellular telephone network, a satellite network, a paging network, or acombination of two or more of these. Network cloud 60 may include one ormore network clouds 60.

In particular embodiments, connections 70 may connect social-networkingsystem 20, client device 30, web-application server 40, and enterpriseservers 50 to communication network cloud 60 or to each other. Thisdisclosure contemplates any suitable connections 70. In particularembodiments, one or more connections 70 include one or more wireline(such as for example Digital Subscriber Line (DSL) or Data Over CableService Interface Specification (DOCSIS)), wireless (such as for exampleWi-Fi or Worldwide Interoperability for Microwave Access (WiMAX)) oroptical (such as for example Synchronous Optical Network (SONET) orSynchronous Digital Hierarchy (SDH)) connections. In particularembodiments, one or more connections 70 each include an ad hoc network,an intranet, an extranet, a VPN, a LAN, a WLAN, a WAN, a WWAN, a MAN, aportion of the Internet, a portion of the PSTN, a cellular telephonenetwork, another connection 70, or a combination of two or more suchconnections 70. Connections 70 need not necessarily be the samethroughout network environment 100. One or more first connections 70 maydiffer in one or more respects from one or more second connections 70.

In particular embodiments, client device 30 may execute one or moreclient applications, such as a web browser (e.g., MICROSOFT WINDOWSINTERNET EXPLORER, MOZILLA FIREFOX, APPLE SAFARI, GOOGLE CHROME, andOPERA, etc.) or special-purpose client application (e.g., Facebook foriPhone, etc.), to access and view content over network cloud 60. Inparticular embodiments, the client applications may allow a user ofclient device 30 to enter addresses of specific network resources to beretrieved, such as resources hosted by social-networking system 20,web-application servers 40, enterprise servers 50, or another suitablehost. These addresses may be Uniform Resource Locators (URLs) or othersuitable address types. Once a webpage or other resource has beenretrieved, the client applications may provide access to other webpagesor resources when the user “clicks” on hyperlinks to other resources. Asan example and not by way of limitation, such hyperlinks may be locatedwithin the webpages and provide an automated way for the user to enterthe URL of another page and to retrieve that page.

More particularly, when a user at a client device 30 desires to view aparticular webpage (hereinafter also referred to as a target structureddocument) hosted by social-networking system 20, or a web applicationhosted by a web-application server 40 (and possibly made available inconjunction with social-networking system 20), the user's web browser,or another client-side structured document rendering engine or suitableclient application, formulates and transmits a request tosocial-networking system 20. The request may include a URL or otherdocument identifier as well as metadata or other information. As anexample and not by way of limitation, the request may includeinformation identifying the user, such as a user ID, as well asinformation identifying or characterizing the web browser or operatingsystem running on the user's client device 30. The request may alsoinclude location information identifying a geographic location of theuser's client device 30 or a logical network location of the user'sclient device 30, as well as timestamp identifying when the request wastransmitted.

FIG. 2A illustrates example components of an example social-networkingsystem 20. In particular embodiments, social-networking system 20 may bea network-addressable computing system that can host an online socialnetwork. Social-networking system 20 may generate, store, receive, andtransmit social-networking data, such as, for example, user-profiledata, concept-profile data, social-graph information, or other suitabledata related to the online social network. In particular embodiments,one or more webpages or web applications, such as those describedherein, may be associated with social-networking system 20 or the onlinesocial network. Social-networking system 20 may be accessed by the othercomponents of network environment 100 either directly or via networkcloud 60. As an example and not by way of limitation, social-networkingsystem 20 may comprise computing systems that allow users at clientdevices 30 to communicate or otherwise interact with each other andaccess content, such as user profiles, as described herein. Inparticular embodiments, social-networking system 20 may include anetwork-addressable computing system that, in various exampleembodiments, comprises one or more physical servers 22, as well as oneor more data stores collectively referred to herein as data store 24(which may be implemented in or by one or more of a variety ofconsolidated or distributed computing systems, databases, or dataservers). The physical servers 22 may be operably connected to computernetwork 60 via, for example, a set of routers or networking switches 26.In particular embodiments, the functionality hosted by the one or morephysical servers 22 may include web or HTTP servers, FTP servers, aswell as, without limitation, webpages and applications implemented usingCommon Gateway Interface (CGI) script, PHP Hyper-text Preprocessor(PHP), Active Server Pages (ASP), Hyper Text Markup Language (HTML),Extensible Markup Language (XML), Java, JavaScript, AsynchronousJavaScript and XML (AJAX), and the like.

In particular embodiments, physical servers 22 may host functionalitydirected to the operations of social-networking system 20. As an exampleand not by way of limitation, social-networking system 20 may host awebsite that allows one or more users, at one or more client devices 30,to view and post information, as well as communicate with one anothervia the website. Hereinafter, servers 22 may be referred to as server22, although, as just described, server 22 may include numerous servershosting, for example, social-networking system 20, as well as othercontent distribution servers, data stores, or databases. Data store 24may store content and data relating to, and enabling, operation of thesocial-networking system 20 as digital data objects including contentobjects. In particular embodiments, a data object may be an item ofdigital information typically stored or embodied in a data file,database, or record. Content objects may take many forms, including:text (e.g., ASCII, SGML, HTML), images (e.g., jpeg, tif and gif),graphics (vector-based or bitmap), audio, video (e.g., mpeg), or othermultimedia, and combinations thereof. Content object data may alsoinclude executable code objects (e.g., games executable within a browserwindow or frame), podcasts, etc. Logically, data store 24 corresponds toone or more of a variety of separate or integrated databases, such asrelational databases or object-oriented databases, that maintaininformation as an integrated collection of logically related records orfiles stored on one or more physical systems. Structurally, data store24 may generally include one or more of a large class of data storageand management systems. In particular embodiments, data store 24 may beimplemented by any suitable physical system(s) including components,such as one or more database servers, mass storage media, media librarysystems, storage area networks, data storage clouds, and the like. Inparticular embodiments, data store 24 may include one or more servers,databases (e.g., MySQL), and/or data warehouses. Data store 24 mayinclude data associated with different social-networking system 20users, client devices 30, web-application servers 40, or enterpriseservers 50, as well as, in particular embodiments, data associated withvarious concepts.

FIG. 2B illustrates an example architecture of the examplesocial-networking system 20 and an example architecture of an exampleclient device 30. In particular embodiments, a client device 30 mayinclude a web browser 202 and a frontend-typeahead process 204. Inparticular embodiments, a social-networking system 20 may include a datastore 24 that includes a social-graph database 206 and a conceptdatabase 216. In particular embodiments, a social-networking system 20may include a physical server 22 that includes a page-generating process200, a backend-typeahead process 208, an edge-generating API 210, anode-generating API 212, a bootstrapping process 214, a recommendationgenerating process 218, and an indexing process 220.

In particular embodiments, the social-networking system 20 may bedescribed or implemented in terms of a social graph includingsocial-graph information. In particular embodiments, data store 24 mayinclude a social-graph database 206 in which the social-graphinformation for use in implementing the social-networking system 20described herein is stored. In particular embodiments, the social-graphinformation stored by social-networking system 20 in data store 24, andparticularly in social-graph database 206, may include a plurality ofnodes and a plurality of edges that define connections betweencorresponding nodes. In particular embodiments, the nodes or edgesthemselves are data objects that include the identifiers, attributes,and information (including the information for their correspondingprofile pages) for their corresponding users or concepts, some of whichis actually rendered on corresponding profile or other pages. The nodesmay also include pointers or references to other objects, datastructures, or resources for use in rendering content in conjunctionwith the rendering of the profile pages corresponding to the respectivenodes.

In particular embodiments, when a request for a webpage or structureddocument hosted by social-networking system 20 is received by thesocial-networking system 20, one or more page-generating processes 200executing within the social-networking system 20 may generate a basewebpage in the form of a Hyper Text Markup Language (HTML), ExtensibleMarkup Language (XML), or other web-browser-supported structureddocument. The generated structured document may then be transmitted in aresponse, which may comprise one or more portions or partial responses,to the requesting client 30 via a Hypertext Transfer Protocol (HTTP) orother suitable connection for rendering by the web browser 202 at theclient device 30. The structured document may include one or moreresources (e.g. JavaScript scripts, code segments, or resources,Cascading Style Sheet (CSS) code segments or resources, image data orresources, video data or resources, etc.), or references to suchresources, embedded within the transmitted document. As an example andnot by way of limitation, a resource embedded in an HTML document maygenerally be included or specified within a script element, imageelement, or object element, among others, depending on the type ofresource. The element referencing or specifying the resource may includea source attribute (e.g., src) identifying a location of the resource,which may be located within a server 22 or data store 24 withinsocial-networking system 20 or at one or more external locations, to theclient device 30 requesting the webpage. Upon receipt of the response,the web browser 202 or other client document rendering applicationrunning at the client device 30 may then construct a document objectmodel (DOM) representation of the received structured document andrequests the resource(s) (which may be at one or more other externallocations) embedded in the document.

In particular embodiments, when a registered user of social-networkingsystem 20 first requests a webpage from social-networking system 20 in agiven user session, the response transmitted to the user's client device30 from social-networking system 20 may include a structured documentgenerated by page-generating process 200 for rendering a login page atthe client device. The user may then enter his user login credentials(e.g., user ID and password), which may then be transmitted from theuser's client device 30 to social-networking system 20. Upon successfulauthentication of the user, social-networking system 20 may thentransmit a response to the user's web browser 202 at the user's clientdevice 30 that includes a structured document generated bypage-generating process 200 for rendering a user homepage, user-profilepage, or another landing page at the user's client device 30.Furthermore, in particular embodiments, which are further describedherein, this or a subsequent response may further include one or moreexecutable code segments (e.g., JavaScript) that, when received by theuser's client device 30, implement a frontend (client-side) typeaheadprocess 204 that executes in conjunction with the user's web browser202.

Social Graphs

FIG. 3 illustrates example social graph 300. In particular embodiments,the social-networking system 20 may store one or more social graphs 300in one or more data stores 24. In particular embodiments, social graph300 may comprise a plurality of nodes, which may include a plurality ofuser nodes 302 and/or a plurality of concept nodes 304, and may alsoinclude a plurality of edges 306 connecting the nodes. The examplesocial graph 300 illustrated in FIG. 3 is shown, for didactic purposes,in a two-dimensional visual map representation. In particularembodiments, the social-networking system 20, client devices 30, orweb-application servers 40 may access the social graph 300 and relatedsocial-graph information for a variety of applications, including someapplications described herein. The plurality of nodes and edges ofsocial graph 300 may be stored as data objects, for example, in datastore 24, and particularly social-graph database 206. Additionally, asdescribed herein, data store 24 may further include one or moresearchable or queryable indexes of nodes or edges generated by indexingsocial-graph database 206.

In particular embodiments, each user node 302 may correspond to a userof the social-networking system 20. As an example and not by way oflimitation, a user may be an individual (human user), an entity (e.g.,an enterprise, business, or third-party application), or a group (e.g.,of individuals or entities) that interacts or communicates with or overa social-networking system 20. As used herein, a “registered user”refers to a user that has officially registered within thesocial-networking system 20. In particular embodiments, when a userregisters for an account with the social-networking system 20, thesocial-networking system 20 may create a user node 302 corresponding tothe user, and store the user node 302 in one or more data stores 24.Generally, the users and user nodes 302 described herein refer toregistered users and the user nodes 302 associated with the users,although this is not necessarily a requirement in other embodiments;that is, in particular embodiments, the users and user nodes 302described herein may refer to users that have not registered with thesocial-networking system 20. As used herein, an “authenticated user”refers to a user who has been authenticated by the social-networkingsystem 20 as being the user claimed in a corresponding profile page towhich the user has administrative rights or, alternately, a suitabletrusted representative of the claimed user. In particular embodiments,the user node 302 may be associated with information provided by theuser and information gathered by various systems, including thesocial-networking system 20. As an example and not by way of limitation,the user may provide his name, profile picture, contact information,birth date, sex, marital status, family status, employment, educationbackground, preferences, interests, or other demographic information. Inparticular embodiments, each user node 302 may be associated with one ormore data objects corresponding to information associated with a user.In particular embodiments, each user node 302 may correspond to one ormore webpages or one or more user-profile pages. As an example and notby way of limitation, in response to a request including a useridentifier of a particular user, social-networking system 20 may accessa corresponding user node 302 based on the user identifier, andconstruct a user-profile page comprising a name, a profile picture, andinterests of the particular user.

In particular embodiments, each concept node 304 may correspond to aconcept. As an example and not by way of limitation, a concept maycorrespond to a place (such as, for example, a movie theater, arestaurant, a landmark, or a city), a website (such as, for example, awebsite associated with the social-network system 20 or a third-partywebsite associated with a web-application server 40), an entity (suchas, for example, a person, a business, a group, a sports team, or acelebrity), a resource (such as, for example, an audio file, a videofile, a digital photo, a text file, a structured document, or anapplication; the resource may be located on the social-networking system20 or on an external server, such as web-application server 40), real orintellectual property (such as, for example, a sculpture, a painting, amovie, a game, a song, an idea, a photograph, or a written work), agame, an activity, an idea or theory, another suitable concept, or twoor more such concepts. An administrative user of a concept (such as, forexample, the owner or administrator of the concept) may create a conceptnode 304 by providing information relating to the concept (e.g., byfilling out an online form), causing social-networking system 20 tocreate a corresponding concept node 304, which may then be stored in oneor more of data stores 24. A concept node 304 may be associated withinformation of a concept provided by an administrative user of theconcept and information gathered by various systems, including thesocial-networking system 20. As an example and not by way of limitation,information of a concept may include as a name or a title, one or moreimages (e.g., an image of the cover page of a book), a location (e.g.,an address, a geographical location), a website (e.g., an URL address),contact information (e.g., a phone number, an email address), othersuitable concept information, or any combination of such information. Inparticular embodiments, each concept node 304 may be associated with oneor more data objects corresponding to information associated with theconcept node 304. In particular embodiments, each concept node 304 maycorrespond to a webpage. As an example and not by way of limitation, inresponse to a request including a name (or an URL address), thesocial-networking system may access a corresponding concept node (storedin one or more of data stores 24) based on the name, and construct awebpage comprising the name, one or more images, and contact informationof the concept.

In particular embodiments, each node in the social graph 300 may,represents, or be represented by, a corresponding webpage (“profilepage”). Profile pages may be hosted by or accessible by thesocial-networking system 20. Profile pages may also be hosted onthird-party websites associated with a web-application server 40. As anexample and not by way of limitation, a profile page corresponding to aparticular external webpage may simply be the particular externalwebpage, and this profile page may correspond to a particular conceptnode 304. Profile pages may be viewable by all or a selected subset ofother users. As an example and not by way of limitation, a user node 302may have a corresponding user-profile page in which the correspondinguser may add content, make declarations, or otherwise express himself orherself. Generally, a user has administrative rights to all or a portionof his or her own respective user-profile page as well as, potentially,to other pages created by or for the particular user including, forexample, home pages, pages hosting web applications, among otherpossibilities. As another example and not by way of limitation, aconcept node 304 may have a corresponding concept-profile page (“hub”)in which one or more users may add content, make declarations, orexpress themselves, particularly in relation to the concept. Althoughthis disclosure generally describes nodes being connected, thisdisclosure also describes profile pages being connected. References toprofile pages being connected generally refer to the nodes correspondingto those profile pages being connected in the social graph 300 by one ormore edges 306, unless context suggests otherwise.

In particular embodiments, a concept node 304 may represent athird-party webpage or resource hosted by web-application server 40. Thethird-party webpage or resource may include a selectable icon (e.g.,implemented in JavaScript, AJAX, or PHP codes) representing an action oractivity. As an example and not by way of limitation, a third-partywebpage for the “Old Pro” about The Old Pro Sports Bar in Palo Alto,Calif., may include a selectable icon such as “like” or “check in,” likethe webpage 520 illustrated in FIG. 5B, or may include selectable iconssuch as, for example, “eat,” “recommend,” or any other suitable actionor activity. A user viewing the third-party webpage may perform anaction by selecting one of the icons (e.g., “eat”), causing clientdevice 30 to transmit to the social-networking system 20 a messageindicating the user's action (e.g., eating at “Old Pro”). If a conceptnode 304 corresponding to the third-party webpage or resource exists insocial graph 300, in response to the message, the social-networkingsystem 20 may create an edge (e.g., an “eat” edge) between a user node302 corresponding to the user and the concept node 304 corresponding tothe third-party webpage or resource, and store the edge 306 in one ormore of data store 24. If a concept node 306 corresponding to thethird-party webpage or resource does not exist in social graph 300, inresponse to the message, the social-networking system 20 may create aconcept node 304 corresponding to the third-party webpage or resource,create an edge 306 (e.g., an “eat” edge) between the newly-createdconcept node and a user node corresponding to the user, and store theconcept node 304 and the edge 306 in one or more of data stores 24.

In particular embodiments, a particular concept may correspond to one ormore concept nodes 304. A social graph 300 may comprise a plurality ofconcept nodes 304 corresponding to a same concept (e.g., a samereal-world entity). That is, each concept node 304 of the severalconcept nodes 304 may correspond to a different webpage that is aboutthe same concept. As an example and not by way of limitation, a popularcelebrity or restaurant may have several webpages, such as, for example,a “fan page,” an “official page,” or a “review page,” authored byvarious users.

In particular embodiments, the plurality of user nodes 302 and conceptnodes 304 may represent administered nodes and un-administered nodes,respectively. The administered nodes (i.e., user nodes 302) may beuser-administered nodes that each correspond to a respective user and arespective user-profile page of that user. In particular embodiments,user-profile pages corresponding to user nodes 302 may be modified,written to, or otherwise administered by, and only by, their respectiveowner (registered) users (unless an official administrator ofsocial-networking system 20 in general desires or requires access tomodify or delete a user's profile page, e.g., as a result of scrupulousor otherwise inappropriate action on the part of the registered user).The un-administered nodes (i.e., concept nodes 304) may benon-user-administered nodes that each correspond to a respective conceptand a respective concept-profile page (also referred to hereinafter as a“hub”) devoted to the respective concept. In particular embodiments,un-administered nodes are nodes having respective concept-profile pages(hubs) that are generally not administered by any one user; rather, inparticular embodiments, hubs may generally be administered, created, andwritten and contributed to or modified by, at least in part, by anyregistered user of social-networking system 20, including, in particularembodiments, users not having connections with the concept nodes 304(that is, users whose user nodes 302 are not necessarily connected withthe concept nodes 304 with edges in the social graph 300 in social-graphdatabase 206). In a sense, hubs may be administered, or contributed to,by the community of registered users of social-networking system 20.

In particular embodiments, a pair of nodes in the social graph 300 maybe connected by one or more edges 306. An edge 306 connecting a pair ofnodes may represent a relationship between the pair of nodes. Inparticular embodiments, each edge 306 may comprise or represent one ormore data objects or attributes corresponding to the relationshipbetween a pair of nodes. As an example and not by way of limitation, afirst user may indicate that a second user is a “friend” of the firstuser. In response to this indication, the social-networking system 20may transmit a “friend request” to the second user. If the second userconfirms the “friend request,” the social-networking system 20 maycreate an edge 306 connecting the first user's user node 302 and thesecond user's user node 302 in social graph 300, and store the edge 306as social-graph information in one or more of data stores 24. In theexample of FIG. 3, social graph 300 includes an edge 306 indicating afriend relation between the user nodes 302 of user “A” and user “B,” andan edge indicating a friend relation between the user nodes 302 of user“C” and user “B.” Although this disclosure describes and FIG. 3illustrates edges 306 with particular attributes connecting user nodes302, this disclosure contemplates edges 306 with any suitable attributesconnecting user nodes 302. As an example and not by way of limitation,an edge 306 may represent a friendship, a family relationship, abusiness or employment relationship, a fan relationship, a followerrelationship, a visitor relationship, a subscriber relationship, asuperior/subordinate relationship, a reciprocal relationship, anon-reciprocal relationship, another suitable type of relationship, ortwo or more such relationships. Moreover, although this disclosuregenerally describes nodes being connected, this disclosure alsodescribes users and/or concepts being connected. References to usersand/or concepts being connected generally refer to the nodescorresponding to those users or concepts being connected in the socialgraph 300 by one or more edges 306, unless context suggests otherwise.

In particular embodiments, each edge type may include one or more edgesub-types that add more detail or metadata describing the specific typeof connection between corresponding pairs of nodes. Each edge 306 may beone of a plurality of edge types based at least in part on the types ofnodes that the edge connects in the social graph 300. Furthermore, insome embodiments, new edge types may be defined or generatedautomatically or dynamically. As an example and not by way oflimitation, information entered into, or in relation to, third party webapplications may cause new edge types to be defined and generated. As anexample and not by way of limitation, a web application for NETFLIX mayresult in an edge type that signifies “movies I want to see.” In suchembodiments in which edges 306 have or are assigned associated edgetypes, the edge 306 itself may store, or be stored with, data thatdefines a type of connection between the pair of nodes the edge 306connects, such as, for example, data describing the types of the nodesthe edge connects (e.g., user, hub, category or classification of hub),privacy settings defining a visibility of the edge 306 to various users,access privileges of an administrator of one of the pair of nodesconnected by the edge 306 with respect to the other node the edge 306connects to (e.g., read or write access of an administrator of one nodewith respect to the other node connected by the edge 306), or datadescribing how or why the edge 306 was first initialized or created(e.g., in response to an explicit user action or declaration, orautomatically without an explicit user action), the strength of theconnection as determined by various factors or criteria related to orshared by the nodes (or more particularly the users or conceptsassociated with the respective connected nodes) connected by the edge306, or other suitable or relevant data.

In particular embodiments, each edge 306 may simply define or representa connection between nodes regardless of the types of nodes the edgeconnects. The edge itself may store, or be stored with, identifiers ofthe nodes the edge 306 connects but may not store, or be stored with,data that describes a type of connection between the pair of nodes theedge connects. Furthermore, in any of these or other embodiments, datathat may indicate the type of connection or relationship between nodesconnected by an edge may be stored with the nodes themselves. Inparticular embodiments, the edges, as well as attributes (e.g., edgetype and node identifiers corresponding to the nodes connected by theedge), metadata, or other information defining, characterizing, orrelated to the edges, may be stored (e.g., as data objects) insocial-graph database 206 and updated periodically or in response tovarious actions or factors (e.g., as a user interacts more with a hub,the edge connecting the respective user and concept nodes may be updatedto reflect this interaction, which may then contribute to an affinity orconnection strength score characterizing the edge as described in moredetail below).

In particular embodiments, an edge 306 between a user node 302 and aconcept node 304 may represent a particular action or activity performedby a user of the user node 302 toward a concept associated with aconcept node 304. As an example and not by way of limitation, asillustrated in FIG. 3, a user may “like,” “attended,” “played,”“listened,” “cooked,” “worked at,” or “watched” a concept, each of whichmay correspond to a edge type or subtype. The concept-profile pagecorresponding to a concept node 304 may include, for example, aselectable “check in” icon (such as, for example, the “check in” icon524 illustrated in FIG. 5B) or a selectable “add to favorites” icon(such as, for example, the icon 526 illustrated in FIG. 5B). Similarly,after a user clicks these icons, the social-networking system 20 maycreate a “favorite” edge or a “check in” edge in response to a user'saction corresponding to a respective action. As another example and notby way of limitation, a user (user “C”) may listen to a particular song(“Imagine”) using a particular application (SPOTIFY, which is an onlinemusic application). In this case, the social-networking system 20 maycreate a “listened” edge 306 and a “used” edge (as illustrated in FIG.3) between the user nodes 302 corresponding to the user and the conceptnodes 304 corresponding to the song and application to indicate that theuser listened to the song and used the application. Moreover, thesocial-networking system 20 may create a “played” edge 306 (again, asillustrated in FIG. 3) between the concept nodes 304 corresponding tothe song and the application to indicate that the particular song wasplayed by the particular application. In this case, the “played” edge306 corresponds to an action performed by an external application(SPOTIFY) on an external audio file (the song “Imagine”). Although thisdisclosure describes edges 306 with particular attributes connectinguser nodes 302 and concept nodes 304, this disclosure contemplates edges306 with any suitable attributes connecting user nodes and conceptnodes. Moreover, although this disclosure describes edges between a usernode and a concept node representing a single relationship, thisdisclosure contemplates edges between a user node and a concept noderepresenting one or more relationships. As an example and not by way oflimitation, an edge 306 may represent both that a user likes and hasused at a particular concept. Alternatively, a separate edge 306 couldbe generated to represent each type of relationship (or multiples of asingle relationship) between a user node 302 and a concept node 304, asillustrated in FIG. 3 between the user node 302 for user “E” and theconcept node 304 for “SPOTIFY.”

In particular embodiments, the social-networking system 20 may create anedge 306 between a user node 302 and a concept node 304 in social graph300. As an example and not by way of limitation, a user viewing aconcept-profile page (such as, for example, by using a web browser or aspecial-purpose application hosted by the user's client device 30) mayindicate that he likes the concept represented by the concept node 304by clicking or selecting a “Like” icon (such as, for example, the “Like”icons 522 illustrated in FIG. 5B or 5C), which may cause the user'sclient device 30 to transmit to the social-networking system 20 amessage indicating the user's liking of the concept associated with theconcept-profile page. In response to the message, the social-networkingsystem 20 may create an edge 306 between the user node 302 associatedwith the user and the concept node 304, as illustrated by the “like”edge 306 between the user node of user “B” and the concept node ofsports bar “Old Pro” in FIG. 3. In particular embodiments, thesocial-networking system 20 may store the edge 306 in one or more ofdata stores 24. Although this disclosure describes forming edges 306 ina particular manner, this disclosure contemplates forming edges 306 inany suitable manner. As an example and not by way of limitation, ratherthan visiting webpage and clicking an icon, a user may use a mobileapplication or another suitable application that is operable to form anedge 306 between the user's user node 302 and a concept node 304.

In particular embodiments, an edge 306 may be automatically formed bythe social-networking system 20 in response to particular user actions.As an example and not by way of limitation, if a first user uploads apicture, watches a movie, or listens to a song, an edge 306 may beformed between the user node 302 corresponding to the first user and theconcept nodes 304 corresponding to those concepts. As another exampleand not by way of limitation, the social-networking system 20 mayautomatically generating nodes and edges based on information currentlybeing entered by a user of social-networking system 20. As yet anotherexample and not by way of limitation, the social-networking system 20may automatically generating nodes and edges based on informationpreviously entered by users of social-networking system 20. Moreinformation on automatically generating nodes and edges may be found inU.S. patent application Ser. No. 12/763,162, filed 19 Apr. 2010, whichis incorporated herein by reference.

User-Profile Pages

FIGS. 4A-4D illustrate example user-profile pages. In particularembodiments, a user node 302 in social graph 300 may correspond to auser-profile page. In particular embodiments, a user-profile page isvisible to the user, the user's friends, and even other non-friend usersdepending on the privacy settings associated with the user node of theuser. A user may set or modify his or her privacy settings via, forexample, the user's user-profile page, a user homepage, anaccount-settings pages, a privacy-settings page, or via another suitableinterface. The user-profile page may comprise a number of differentsubpages viewable or accessible via selecting one or more tabs 401. Asan example and not by way of limitation, in the embodiment illustratedin FIG. 4A, the user-profile page includes a Wall (feed) tab 401 a foraccessing a wall (feed) for postings, an Info tab 401 b for entering anddisplaying information about or related to the user, a Photos tab 401 cfor uploading and displaying photos, and a Boxes tab 401 d. A user mayselect a particular photo or picture uploaded in photos tab 401 c fordisplay as a user profile picture 403. In particular embodiments, theuser's profile picture 403 as well as other features such as, forexample, the options to send a message to another user, edit the profilepage, view friends of the user, or view photos of the user, may bedisplayed in a “chrome” (border) region of the page no matter which oftabs 401 is selected. In particular embodiments, a search bar or searchinterface may be included in the chrome of a user-profile page (as wellas other pages), enabling users to input queries for social-networkdata, such as, for example, the names or attributes of other users orconcepts the user desires to search for.

In particular embodiments, a portion of, or all of, the informationaccessible or visible to the user and other users via the user-profilepage may be self-declared. A user may type or otherwise inputinformation or content in various sections or forms that may or may notautomatically appear by default when the user-profile page is created.In particular embodiments, a user may edit his or her user-profile pageat anytime the user is logged into social-networking system 20. As anexample and not by way of limitation, user-profile pages may includedata that describe the respective users of the online social networkenabled by social-networking system 20, which may include, for example,proper names (first, middle and last of a person, a trade name orcompany name of a business entity, etc.), nicknames, biographic,demographic, and other types of descriptive information in a basicinformation section 402 under Info tab 401 b. The basic informationsection 402 may further include a user's sex, current city of residence,birthday, hometown, relationship status, political views, what the useris looking for or how the user is using the social network (e.g., forlooking for friendships, relationships, dating, networking, etc.), andthe like.

In particular embodiments, a user-profile page may also include apersonal information section 406 where the user can enter more personaldeclarations. As an example and not by way of limitation, a personalinformation section 406 may include a sub-section 408 in which the usermay declare various activities he, she, or it participates in or enjoyssuch as, for example, sports or music. As an example and not by way oflimitation, in section 408, the user may declare these activities by,for example, simply listing the activities. As an example and not by wayof limitation, the user may list “weight lifting, hiking, playingping-pong, and foosball,” or may use phrases such as, for example, “Ienjoy weightlifting, I like hiking, I love playing ping-pong, I'm goodat foosball.” The user may separate or delineate his or her declaredactivities (and other declarations described below) with, for example,commas, semicolons, dashes, or carriage returns (which may berecognizable by the typeahead or bootstrapping processes describedbelow). The personal information section 406 may also include asub-section 410 in which the user may declare various interests. Again,the user may simply list such interests, such as by typing, for example,“reading and photography,” or by using phrases such as, for example, “Ilike to read, I like photography.” As another example, interests section406 may include a favorite music sub-section 412 in which the user maydeclare music he or she likes or is interested in, a favorite TV showssub-section 414, a favorite movies sub-section 416, a favorite bookssub-section 418, a favorite quotations sub-section 420, and even ageneral “about me” sub-section 422 in which the user may enter generaldeclarations about himself or herself that may not fit under thepreviously described sections.

In particular embodiments, a user-profile page may also include acontact information section 424 in which the user may enter variouscontact information including, for example, email addresses, phonenumbers, residential address, work address, or other suitable contactinformation. A user-profile page may also include an education and worksection 426 in which the user may enter his or her educational oremployment history. As an example and not by way of limitation, a usermay declare that he or she attended Stanford University in section 426by, for example, simply typing “Stanford University,” by typing “Iattended Stanford University,” or by selecting Stanford University froma menu interface. The user may also describe more specific information,such as, for example, the degree awarded, the field of the degree, thegraduation date, etc. As another example, section 426 may enable theuser to enter the user's work experience. As an example and not by wayof limitation, a user may declare that he or she works at “Acme” companyby, for example, simply typing “Acme,” by typing “I work at Acme,” orselecting the company “Acme” from a menu.

In particular embodiments, a user-profile page also includes a friendssection 428 (which may be visible in the chrome or other region of thepage) that displays all or a subset of the user's friends as defined byedges 306 in the social graph 300 stored in social-graph database 206.In particular embodiments, the user may click on a name or thumbnailimage 429 associated with a friend resulting in the directing of theuser to the user-profile page of the selected friend. In particularembodiments, any action that a user takes with respect to another seconduser, whether or not the second user may be a friend of the user or not,and, in particular embodiments, actions that the user takes with respectto various concept nodes, may be displayed in a recent activity section430, which may be viewable as a sub-section within a wall (feed) section432 under Wall (feed) tab 401 a. Generally, wall (feed) section 432 is aspace on every user's profile page that allows the user and friends topost messages via input box 434 for the user and friends to see, as wellas to comment or otherwise express themselves in relation to posts onthe wall (feed).

In particular embodiments, a user may edit his or her user-profile pageand make declarations by clicking or otherwise selecting an edit link440 corresponding to the section that the user desires to edit or make adeclaration. As an example and not by way of limitation, FIG. 4Cillustrates the resultant rendered webpage displayed to the user at theuser's client device 30 after the user has selected the edit link 440corresponding to the personal information section 406. As shown in FIG.4C, a plurality of form boxes 409, 411, 413, 415, 417, 419, 421, and 423are rendered enabling the user to type or otherwise enter declarationsinto corresponding sections 408, 410, 412, 414, 416, 418, 420, and 422,respectively. As the user enters text characters into a form box, thefrontend and backend-typeahead processes 204 and 208 may attempt toidentify existing concept nodes 304 (or user nodes 304, e.g., especiallyuser nodes corresponding to celebrities, businesses, or organizations)that match the string of characters entered in the user's declaration asthe user is entering the characters.

In particular embodiments, a user may submit a query to thesocial-network system 20 by inputting a text query into search field450. The query may be an unstructured text query and may comprise one ormore text strings or one or more n-grams. In general, a user may inputany character string into search field 450 to search for content on thesocial-networking system 20 that matches the text query. Thesocial-networking system 20 may then search data store 24 (or, moreparticularly, social-graph database 206 or concept database 216) toidentify content matching the query. The identified content may include,for example, social-graph entities (i.e., user nodes 302, concept nodes304, edges 306), profile pages, external webpages, or any combinationthereof. The page-generating process 200 of the social-networking system20 may then generate a search results webpage with search resultscorresponding to the identified content. The search results webpage mayinclude reference to some or all of the identified content that matchedthe text query. The social-networking system 20 may then transmit thesearch results webpage to the user's web browser 202 on the user'sclient device 30. The user may then click or otherwise select thecontent from the search results webpage to access the content from thesocial-networking system 20 or from an external system, as appropriate.Although this disclosure describes querying the social-networking system20 in a particular manner, this disclosure contemplates querying thesocial-networking system 20 in any suitable manner.

Concept-Profile Pages

FIGS. 5A-5C illustrate example concept-profile pages. In particularembodiments, a concept node 304 in social graph 300 may correspond to aconcept-profile page. In particular embodiments, concept nodes 304 andtheir respective hubs may be explicitly created by users ofsocial-networking system 20 or generated automatically bysocial-networking system 20. Similar to user-profile pages,concept-profile pages (also referred to as “hubs”) share informationrelated to the concept associated with the corresponding concept node304. In particular embodiments, any registered user logged in tosocial-networking system 20 and viewing a hub may add content to the hub(such as, for example, in a manner similar to a wiki-site). As anexample and not by way of limitation, FIG. 5A illustrates an example hubfor the movie “The Shawshank Redemption.” In particular embodiments, andas illustrated in FIG. 5A, a hub may include sub-pages accessible viawall (feed) tab 501 a, info tab 501 b, photos tab 501 c, and boxes tab501 d similar to a user-profile page. A hub may also generally include abasic information section 502, a detailed info section 504, as well as,potentially, other sections. Information included in a concept-profilepage may be provided, for example, by an administrator associated withthe concept or concept node 304, by a user viewing the hub (although inparticular embodiments, there may be a time-delay associated with acontent approval or synchronization process before the user-generated oruser-added content is visible in the hub), by the social-networkingsystem 20 (based on extracted information from internal orexternal/third-party sources (e.g., WIKIPEDIA)), or by another suitablesource. A hub may also include a photo or picture section under photostab 501 c allowing users to upload images in or related to the concept,one of which may be selected as a profile picture 512 for the hub. Asanother example and not by way of limitation, FIG. 5B illustrates awebpage for the “Old Pro,” a sports bar in Palo Alto, Calif. The webpagemay include, for example, a selectable “like” icon 522, a selectable“check in” icon 524, a selectable “add to favorites” icon 526, othersuitable components, or any combination thereof. As yet another exampleand not by way of limitation, FIG. 5C illustrates a webpage for thepicture of “Matthew.” The webpage may include, for example, a selectable“like” icon 522, a selectable “comment” icon 534, a history of commentsand “likes” from various users in field 536, an indication of theapplication corresponding to the concept node in field 538, othersuitable components, or any combination thereof. Although thisdisclosure describes and FIGS. 5A-5C illustrate particular webpagesassociated with particular concept nodes, this disclosure contemplatesany suitable webpages associated with any suitable concept nodes.Moreover, although this disclosure describes concept nodes beingassociated with webpages, this disclosure contemplates concept nodesthat are not necessarily associated with webpages. As an example and notby way of limitation, a concept node may correspond to a song or othermusical work that it not associated with any particular webpage.

In particular embodiments, wall (or news feed/activities feed) section501 a, or other feed or activities section of the hub, displayscomments, status updates, wall posts and other user activitiesassociated with the user and friends of the user that are viewing thehub. The wall (or news feed/activities feed) section 501 a, or otherfeed or activities section of the hub may also display comments, statusupdates, wall posts and other user activities and user generated contentthat are related to the concept for which the hub was created. Moreparticularly, one or more processes within social-networking system 20may perform a search on comments, status updates, wall posts and otheruser-generated content and user activities associated with therequesting user and friends of the requesting user filtered by concept;that is, a keyword search for keywords related to the concept of thecurrently requested or viewed hub (and potentially keywords related tothe concepts associated with the recommended hubs) in these streams ofuser feeds or activities related to the requesting user and therequesting user's friends, and display this subset of user content oractivities in the wall or feed section 501 a of the currently requestedor viewed hub. As an example and not by way of limitation, U.S. patentapplication Ser. No. 12/704,400, filed 11 Feb. 2010, describes methods,processes, or systems for performing such searching, filtering, anddisplaying, and is hereby incorporated by reference herein. Wall or feedsection 501 a may also include a section, which may be a separatesection from that just described, that displays comments, statusupdates, wall posts and other user activities of any and all users ofsocial-networking system 20 that are related to the concept for whichthe hub was created, not just those of the user and friends of the userviewing the hub.

In particular embodiments, the default sections displayed in aparticular hub upon creation of the hub may depend on the conceptitself; that is, concept nodes 304 may be categorized bysocial-networking system 20, and these categories (e.g., people, places,things, activities, sports, sports teams, celebrities, cities,locations, movies, actors, books, restaurants, etc.) may dictate, atleast in part, which sections are displayed on a particular hub. As anexample and not by way of limitation, a movie hub may include a sectionor sub-section for entering actors starring in the movie, as illustratedin FIG. 5A, as well as sections or sub-sections for entering informationsuch as the director, writer, releasing studio, release date, etc. Inparticular embodiments, a hub may also include a section 508 (which, inparticular embodiments, may be visible no matter which of tabs 501 arecurrently selected) that lists or displays users that have connections(and corresponding edges 306 in the social graph 300) to or with theconcept (and its corresponding concept node 304), such as a fans section508 in the example illustrated in FIG. 5A. As an example and not by wayof limitation, such users may have connections, and associated edges 306stored in social-graph database 206, indicating, for example, that theylike the movie, saw the movie, want to see the movie, acted in themovie, etc. In particular embodiments, the users displayed in fanssection 508 may only include users who are also friends with the usercurrently viewing the hub.

In particular embodiments, a hub may include a recommendations section510 (which, in particular embodiments, may be visible no matter which oftabs 501 are currently selected) that includes or displays a list or setof names 512, thumbnail images 514, or other identifiers associated withother hubs, each of which may include a hyperlink to the respectiveother hub. As an example and not by way of limitation, as illustrated inFIG. 5A, a recommendations section 510 for a hub corresponding to amovie may display hubs corresponding to movies that are directed by thesame director, movies sharing some of the same actors, movies of thesame genre, or movies liked by friends of the user, etc. In particularembodiments, the hubs displayed or listed in recommendations section 510may be considered relevant to, have some determined relation to, or bedetermined based on leveraging information extracted from social-graphdatabase 206 about, one or more of: the particular user (also referredto hereinafter as the “requesting user”) requesting or currently viewingthe particular hub (also referred to hereinafter as the “requestedhub”), the requested hub, friends of the user whose user nodes 302 mayor may not also be connected to the requested hub's concept node 304with respective edges, other hubs having respective concept nodes 304that are also connected to the requested hub's concept node 304, or anycombination thereof. As an example and not by way of limitation, therecommended hubs displayed in recommendations section 510 may includehubs that are liked or otherwise connected (with edges 306 insocial-graph database 206) to friends of the requesting user (as definedby edges 306 in social-graph database 206), and particularly friendsthat are also connected to the requested hub (with edges 306 insocial-graph database 206). As another example, the recommended hubsdisplayed in recommendations section 510 may include hubs that users,and particularly friends of the requesting user (as defined by edges 306in social-graph database 206), also like or are otherwise connected to(with edges 306 in social-graph database 206), but who aren'tnecessarily connected with the requested hub (with edges 306 insocial-graph database 206). As yet another example, the recommended hubsdisplayed in recommendations section 510 may include hubs that areconnected to the requested hub (with edges 306 in social-graph database206) and one or more friends of the requesting user (as defined by edges306 in social-graph database 206). As yet another example, therecommended hubs displayed in recommendations section 510 may includehubs that are connected to the requested hub (with edges 306 insocial-graph database 206) but that aren't necessarily connected withfriends of the requesting user (as defined by edges 306 in social-graphdatabase 206).

In particular embodiments, social-networking system 20 may provide ameans or process (e.g., selectable links or user interfaces) for thetrue voices of hubs corresponding to concept nodes 304 (orun-authenticated user-profile pages corresponding to un-authenticateduser nodes 302 b), such as the actual celebrity or business for which aconcept node 304 has previously been created, to claim these conceptnodes 304, thereby assuming administrative rights over them andredefining them in the social graph 300 as, for example, registeredauthenticated user nodes 302 a (or, alternately, as authenticatedconcept nodes 304).

Typeahead Processes

Particular embodiments further relate to a method for automaticallygenerating nodes and edges in a social graph 300 based on informationcurrently being entered by a user of a social-networking system 20. Inparticular embodiments, one or more client-side and/or backend(server-side) processes implement and utilize a “typeahead” feature toautomatically attempt to match concepts corresponding to respectiveexisting concept nodes 304 to information currently being entered by auser in an input form rendered in conjunction with a requested webpage,such as a user-profile page, which may be hosted or accessible in, bythe social-networking system 20. In particular embodiments, when a matchis found, these or other processes may then automatically generate anedge from a user node 302 corresponding to the user to the existingconcept node 304 corresponding to the concept match. Particularembodiments further relate to one or more processes that automaticallycreate a new node and an edge from the new node to the user's node whena match to an existing concept and corresponding node is not found, orat least not found with a desired level of certainty. As an example andnot by way of limitation, as will be described below, various webpageshosted or accessible in, the social-networking system 20 such as, forexample, user-profile pages, enable users to add content, declareinterests, or otherwise express themselves (hereinafter also referred tocollectively as “declarations”), including by linking to, or otherwisereferencing additional content, such as media content (e.g., photos,videos, music, text, etc.), uniform resource locators (URLs), an othernodes, via their respective profile pages or other concept-profilepages. Such declarations may then be viewable by the authoring users aswell as other users. In particular embodiments, as a user is enteringtext to make a declaration, the typeahead feature attempts to match thestring of textual characters being entered in the declaration to stringsof characters (e.g., names) corresponding to existing concepts (orusers) and corresponding concept (or user) nodes in the social graph300. In particular embodiments, when a match is found, the typeaheadfeature may automatically populate the form with a reference to the node(such as, for example, the node name, node ID, or another suitablereference or identifier) of the existing node and, as just described,cause an edge 306 to be created between the matching existing node andthe user node 302 associated with the user. In particular embodiments,as a user continues to enter text and the typeahead feature maydetermine that all or a portion of the declaration does not match anyexisting node, at least according to a statically or dynamicallydetermined level of certainty, the typeahead feature may cause thesocial-networking system 20 to automatically create a new node based onthe declaration entered by the user, as well as an edge from the user'snode to the new node.

Particular embodiments further relate to a method for automaticallygenerating nodes and edges based on information previously entered byusers of a social-networking system 20. In particular embodiments, oneor more backend (server-side) processes may implement and utilize a“bootstrapping” feature to automatically attempt to match known conceptsindexed in a data store, each of which may or may not be associated withor correspond to a respective existing concept node 304 in the socialgraph 300, to information previously entered by a user in one or more ofa variety of forms or formats and stored in the social-networking system20. In particular embodiments, when a match to a known concept is found,these or other processes may then automatically generate an edge 306from a node corresponding to the user (for which the previously enteredinformation was matched) to an existing concept node 304 correspondingto the concept match. Particular embodiments further relate to one ormore processes that, when a match to a known concept is found but whereno concept node 304 currently exists for the known concept,automatically create a new concept node 304 for the known concept and anedge 306 from the new concept node 304 to the user node 302 associatedwith the user. Particular embodiments further relate to one or moreprocesses that, when a match to a known concept or existing concept node304 is not found, or at least not found with a desired level ofcertainty, automatically create a new concept node 304 based on thepreviously entered information and an edge 306 from the new concept node304 to the user node 304 associated with the user. More information onautomatically generating nodes and edges may be found in U.S. patentapplication Ser. No. 12/763,162, filed 19 Apr. 2010, which isincorporated by reference.

Particular embodiments further relate to a method for populating aconcept database 216 using data obtained from one or more internal orexternal sources. In particular embodiments, the concept database 216may include an index of known concepts as well as, in some embodiments,various attributes, metadata, or other information associated with therespective concepts. In particular embodiments, one or more backend(server-side) processes may crawl one or more external data sources(e.g., WIKIPEDIA (www.wikipedia.org), FREEBASE (www.freebase.com,available from METAWEB), or the internet in general) to facilitate oraid in generating or populating the concept database 216. In particularembodiments, the concept database 216 may also be augmented withinformation extracted from users of the social-networking system 20described herein.

Particular embodiments further relate to a method for generating one ormore recommendations for display to a user of a social-networking system20 currently viewing a particular webpage or structured document hostedat least in part by the social-networking system 20. In particularembodiments, one or more server-side recommendation-generating processes218 may generate the recommendations for display to the user in (on) thecurrently viewed page based at least in part on information extractedfrom a social graph 300. More particularly, the one or more server-siderecommendation-generating processes 218 may leverage the social-graphinformation including information related to the user, the currentlyviewed page, friends of the user who are also connected in some fashionto the currently viewed page, and other webpages or structured documentsconnected in some fashion to the currently viewed page, to determine oneor more other webpages or structured documents that the user may desireto connect to and then subsequently generate a list or set of theserecommended pages for display in some fashion to the user in thecurrently viewed page.

In particular embodiments, as described in more herein, one or moreterms in declarations entered in one or more of the previously describedsections or sub-sections of a webpage of the online social network maybe highlighted, rendered in a different color, underlined, or clickable.As an example and not by way of limitation, a term inputted by the userthat matches to a node or edge of social graph 300 may be highlighted,rendered in a different color, underlined, or made clickable by thesocial-networking system 20 (either as the term is inputted by the useror after the term is inputted) to indicate that the term matches anelement of the social graph 300. In particular embodiments, particularterms on a webpage may match to particular nodes and edges, and theseterms may be associated with a hyperlink that, when clicked or otherwiseselected, directs the user to a profile page associated with the node oredge. As an example and not by way of limitation, a known concepts orexisting concept nodes 304 may be associated with a hyperlink that, whenclicked, directs the user's web browser 202 to a concept-profile pagecorresponding to the concept node 304. In particular embodiments, a termmay match to a node or edge when the term is identical or substantiallysimilar to the name or identifier associated with the node or edge, orotherwise identifiable as being associated with the node or edge. As anexample and not by way of limitation, clicking on a hyperlinkcorresponding to “Family Guy” in favorite TV shows section 414 maydirect the user to a webpage (a concept-profile page/hub as describedbelow) devoted to the Family Guy TV show.

In particular embodiments, as a user types or otherwise enters text intoa form used to add content or make declarations in various sections ofthe user's profile page or other page, the frontend-typeahead process204 may work in conjunction with one or more backend (server-side)typeahead processes 208 (hereinafter referred to simply as“backend-typeahead process 208”) executing at (or within) thesocial-networking system 20 (e.g., within servers 22), to interactivelyand virtually instantaneously (as appearing to the user) attempt toauto-populate the form with a term or terms corresponding to names ofexisting hubs, or terms associated with existing hubs, determined to bethe most relevant or best match to the characters of text entered by theuser as the user enters the characters of text. Utilizing thesocial-graph information in social-graph database 206 or informationextracted and indexed from social-graph database 206, includinginformation associated with nodes as well as edges 306, the frontend andbackend-typeahead processes 204 and 208, in conjunction with theinformation from social-graph database 206, as well as potentially inconjunction with various others processes, applications, or databaseslocated within or executing within social-networking system 20, are ableto predict a user's intended declaration with a high degree ofprecision. However, social-networking system 20 also provides user'swith the freedom to enter any declaration they wish enabling users toexpress themselves freely. As such, social-networking system 20 enablesthe creation of new hubs and corresponding concept nodes 304 related tovirtually any concept.

In particular embodiments, as a user enters text characters into a formbox or other field, the frontend and backend-typeahead processes 204 and208 may attempt to identify existing user nodes 302 or concept nodes 304that match the string of characters entered in the user's declaration asthe user is entering the characters. In particular embodiments, as theuser enters characters into a form box, the frontend-typeahead process204 may read the string of entered textual characters. As each keystrokeis made, the frontend-typeahead process 204 may transmit the enteredcharacter string as a request (or call) to the backend-typeahead process208 executing within social-networking system 20. In particularembodiments, the frontend and backend-typeahead processes 204 and 208may communicate via AJAX (Asynchronous JavaScript and XML) or othersuitable techniques, and particularly, asynchronous techniques. In oneparticular embodiment, the request is, or comprises, an XMLHTTPRequest(XHR) enabling quick and dynamic sending and fetching of results. Inparticular embodiments, the frontend-typeahead process 204 alsotransmits before, after, or with the request a section identifier(section ID) that identifies the particular section of the particularpage in which the user is making the declaration. In particularembodiments, a user ID parameter may also be sent, but this may beunnecessary in some embodiments, as the user is already “known” based onhe or she logging into social-networking system 20.

In particular embodiments, as the backend-typeahead process 208 receivesrequests or calls including a string of user-entered character data andsection identifier, the backend process 208 may perform or causes to beperformed (e.g., in conjunction with one or more other search processesexecuting at social-networking system 20) a string search to identifyexisting user nodes 302 or concept nodes 304 having respective names orother identifiers matching the entered text, and in particularembodiments, matching a particular category of nodes in social-graphdatabase 206 as determined, at least in part, by the particular sectionidentifier. The granularity of the categories may vary. As an exampleand not by way of limitation, hubs corresponding to actors, directors,producers, movie types or genres, may all be grouped in a “movie”category while. As another example and not by way of limitation, hubscorresponding to actors, directors, producers, movie types or genres,may each represent its own category. Similarly, in one example, hubscorresponding to football, basketball, soccer, rugby, and tennis may allbe grouped in a “sports” category, while in another example each ofthese may represent its own category. In particular embodiments, thebackend-typeahead process 208 may perform string matching. Thebackend-typeahead process 208 may attempt to match the latest string ofcharacters received from the frontend-typeahead process 204 to an indexof strings each corresponding to a name of a node in social-graphdatabase 206. In particular embodiments, the index of strings is updatedperiodically or as user nodes 302 and concept nodes 304 are added to thesocial-graph database 206 or other index generated from social-graphdatabase 206. The backend-typeahead process 208 may use one or more of avariety of factors when attempting to match the string of entered textand as such may examine one or more of a variety of different aspects orattributes of existing nodes in social-graph database 206. As an exampleand not by way of limitation, in addition to attempting to match theentered text to names (name strings) of existing nodes, thebackend-typeahead process 208 may use the section identifier todetermine a category of the declaration which may be then used to searcha subset of existing concept nodes 304 associated with the category. Inparticular embodiments, backend-typeahead process 208 searches orqueries an index of nodes generated from social-graph database 206 inwhich the nodes are indexed and searchable (or queryable) by hubcategory. The backend-typeahead process 208 may also use informationabout the user entering the text including information entered in theuser's profile page, information about the users friends, informationabout other user nodes 302 or concept nodes 304 the user is connectedwith, etc. in order to best match a user declaration to an existing useror concept and respective its respective user node 302 or concept node304. The backend-typeahead process 208 may also attempt to correctspellings or match to synonyms of the user-entered characters orextrapolations of entered characters.

In particular embodiments, the backend-typeahead process 208 may use oneor more matching algorithms to attempt to identify matching nodes. Inparticular embodiments, when a match or matches are found, thebackend-typeahead process 208 may transmit a response (which may utilizeAJAX or other suitable techniques) to the user's client device 30 thatmay include, for example, the names (name strings) of the matching nodesas well as, potentially, other metadata associated with the matchingnodes. As an example and not by way of limitation, FIG. 4D illustratesthe result of the user entering the characters “wei” into form box 409corresponding to activities section 408. In the example illustrated inFIG. 4D, the frontend-typeahead process 204 displays a drop-down menu442 that displays names of matching existing profile pages andrespective user nodes 302 or concept nodes 304 (e.g., a hub named ordevoted to “weight lifting”), which the user can then click on orotherwise select thereby confirming the desire to declare the matcheduser or concept name corresponding to the selected node. As anotherexample and not by way of limitation, upon clicking “weight lifting,”the frontend-typeahead process 204 auto-populates, or causes the webbrowser 202 to auto-populate, the form box 409 with the declaration“weight lifting”. In particular embodiments, the frontend-typeaheadprocess 204 may simply auto-populate the form with the name or otheridentifier of the top-ranked match rather than display a drop-down menu.The user may then confirm the auto-populated declaration simply bykeying “enter” on his or her keyboard or by clicking on theauto-populated declaration.

In particular embodiments, upon user confirmation of the matching node,the frontend-typeahead process 204 may transmit a request to thebackend-typeahead process 208 that informs the backend-typeahead processof the user's confirmation of the matched profile page. In particularembodiments, in response to the request transmitted, thebackend-typeahead process may automatically (or alternately based on aninstruction in the request) call or otherwise instruct anedge-generating API (Application programming interface) 210 to create anedge 306 in the social graph 300 stored in social-graph database 206between the particular user's node 302 and the particular user node 302or concept node 304 corresponding to the confirmed declaration. Inparticular embodiments, the request transmitted may not be generated andtransmitted by the frontend-typeahead process 204 until the user hasselected the save changes (or other submit) button 444 indicatingconfirmation of the user's desire to make the declaration (ordeclarations made in any and all of the displayed form boxes).

In particular embodiments, the node types or categories of existingnodes as, for example, determined based, at least in part, on thesection category as identified by the corresponding section identifierfor the section in which the declaration was made (e.g., friends,favorite movies) or based on social-graph information stored insocial-graph database 206, may be used by the backend-typeahead process208 to better match a string of entered characters of a declaration toexisting nodes that may be candidates for matching nodes. As an exampleand not by way of limitation, consider an example in which a user types“jaguar” into a user profile section. In such an example, thebackend-typeahead process 208 may identify numerous existing nodes (andtheir associated profile pages) having corresponding names that at leastinclude the name “jaguar,” or a derivation thereof (e.g., “jaguars”). Asan example and not by way of limitation, the backend-typeahead process208 may identify a user node 302 associated with a user named “VictoriaJaguar.” As another example and not by way of limitation, thebackend-typeahead process 208 may identify a concept node 304 associatedwith the jungle cat jaguar. As yet another example, thebackend-typeahead process 208 may identify a concept node 304 devoted tothe JACKSONVILLE JAGUARS professional football team and still anotherconcept node 304 devoted to the JAGUAR luxury and performance car-maker.In such cases, all of these user nodes 302 or concept nodes 304 may bematched by the backend-typeahead process 208 and hence, all of the nodenames may be transmitted in some embodiments, while in otherembodiments, the backend-typeahead process 208 may only transmit onematching node name that is determined to be the most relevant based, forexample and as described above, on using the section ID or otherparameters extracted from the user's profile to determine a category inwhich the most relevant matching user node 302 or concept node 304 wouldbe indexed in.

Additionally, in some embodiments, other factors may also be used todetermine the strength or relevancy of the matching concept nodes 304including, for example, the number of the user's friends havingrespective user nodes 302 connected with a matching concept node 304,the number of total users having respective user nodes 302 connectedwith a matching concept node 304, the number of other concept nodes 304connected with the matching concept node 304, information obtained byanalyzing other concept nodes 304 connected to both the user's node 302and a matching concept node 304, or other concept nodes 304 connected tonodes 302 corresponding to friends of the user as well as to a matchingconcept node 304. Moreover, as described below, informationcharacterizing the strength of the connections associated with the edgesconnecting any of these nodes may also be used to weight their relevancyin determining the most relevant matching concept nodes 304.

In particular embodiments, the backend-typeahead process 208 may makeone or more determinations before the frontend-typeahead process 204auto-populates a form box with names corresponding to matched profilepages and their respective user nodes 302 or concept nodes 304. First,considering the above example, in the case that a plurality of matchesto existing nodes are identified, the backend-typeahead process 208 maythen determine a confidence score for each of the matches that indicatesan absolute or relative quality of each of the names of the matchingnodes, the quality of the matching nodes themselves, or otherwise alevel of confidence that the backend-typeahead process 208 has that thematch is correct (the intended concept the user was entering or tryingto enter). This determination may also result or involve a ranking ofthe matches (which may be reflected in the order of the matchesdisplayed in the drop-down menu 442).

In particular embodiments, one or more factors may be used to determinea confidence score, probability, quality, or ranking of a matching node.As an example and not by way of limitation, such factors may againinclude, the number of the user's friends having respective user nodes302 connected with a matching concept node 304, the number of totalusers having respective user nodes 302 connected with a matching conceptnode 304, the number of other concept nodes 304 connected with thematching concept node 304, information obtained by analyzing otherconcept nodes 304 connected to both the user's node 302 and a matchingconcept node 304, other concept nodes 304 connected to nodes 302corresponding to friends of the user as well as to a matching conceptnode 304, other suitable factors, or any combination thereof. Othersuitable factors may also include the number of sections on thecorresponding candidate matching hub that are filled in, therelationship of content displayed on the hub corresponding to thematching concept node to the content, including other declarations,displayed on the user's profile page, etc. Again, as described below,information characterizing the strength of the connections associatedwith the edges 306 connecting any of these nodes may also be used toweight their relevancy in determining the most relevant matching conceptnodes 304. Referring back to the “jaguar” example, the backend-typeaheadprocess 208 may identify another declaration of the user that says “Ilove watching football,” and as such, based on this identification (aswell as other factors), the backend-typeahead process 208 may rank thenode corresponding to the JACKSONVILLE JAGUARS professional footballteam as the best match and the frontend-typeahead process 204 may listthe name of this node at the top of the drop-down menu or automaticallyauto-populate the form with the name.

In particular embodiments, the backend-typeahead process 208 may thenmake one or more second determinations before the frontend-typeaheadprocess 204 auto-populates a form box with names corresponding to rankedmatched nodes. As an example and not by way of limitation, based on theconfidence scores, one or both of the frontend and backend-typeaheadprocesses 204 and 208 may determine whether there is a determined levelof probability, certainty, or confidence (a confidence score) for eachmatch before the match is displayed to the user in the form of adrop-down menu for selection or auto-populated in the form box. That is,in particular embodiments, even though one or more matches have beenidentified from the existing nodes in the social-graph database 206,their respective certainties (in being the actual concept the user wasintending to declare) as demonstrated by their determined confidencescores may be below a first predetermined threshold, and hence, none ofthe matches may be displayed to the user and be auto-populated by thefrontend-typeahead process 204. That is, rather than display and providethe user with the match or matches having confidence scores below thethreshold, the frontend-typeahead process 204 may allow the user tofinish typing the declaration himself or herself, and then transmit therequest. The backend process 208 may determine the best matchcorresponding to the user's declaration.

In particular embodiments, the determination of whether a match ormatches have been found may be based on comparing respective confidencescores determined for the prospective matches with a secondpredetermined threshold below the first predetermined thresholddescribed above. That is, the second predetermined threshold may be usedwhen determining if a match is found while the first predeterminedthreshold may be used when determining if the match should be autopopulated for display to the user.

In particular embodiments, if no suitable match is identified to apredetermined level of certainty (e.g., based on comparison ofconfidence scores with the second threshold), or the user abstains fromselecting a provided or auto-populated match, then, as the usercontinues to enter characters of text in a declaration, thefrontend-typeahead process 204 may wait until the user is finishedentering the declaration as, for example, indicated by the user clickingor otherwise selecting the save changes button 444, before transmittingthe character string, section identifier, or other information/data tobackend-typeahead process 208.

In particular embodiments, the bootstrapping process 214 may scan datastructure 24, including social-graph database 206, for text entered orotherwise associated with or stored with each user of social-networkingsystem 20. As described herein, all of the information about orassociated with a given user including that entered and displayed withthe user's profile page may be stored with the user's node 302 insocial-graph database 206. In particular embodiments, for each user (butalso, in some embodiments, potentially each hub having a correspondingconcept node 304), bootstrapping process 214 may identify all of thefields or objects associated with the user's node 302 that containtextual characters. Such fields may include any of sections 408, 410,412, 414, 416, 418, 420, and 422 in the user's profile page as well as,in some embodiments, text in private messages sent between the user andother users, public messages posted in wall (feed) sections, statusupdates, captions below photos, etc.

In particular embodiments, for each field or object containing text,bootstrapping process 214 may perform some amount of pre-processing ofthe text. As an example and not by way of limitation, some or all thetext in a given field may be considered a single character string. Asanother example and not by way of limitation, some or all of the text ina given field may be considered one or more n-grams. In particularembodiments, pre-processing of the character string may include applyinga set of one or more heuristic rules to parse, separate, or delimit thecharacter string into separate words, phrases, or n-grams associatedwith distinct node (i.e., user or hub/concept) candidates. Moreparticularly, pre-processing may involve bootstrapping process 214separating the character string in a given field by delimiters (e.g.,commas, semicolons, carriage returns, etc.). As an example and not byway of limitation, the character string illustrated in section 408 ofFIG. 4A may be delimited into four distinct concept or hub candidates,the first distinct hub candidate being “weight lifting,” the seconddistinct hub candidate being “hiking,” the third distinct hub candidatebeing “playing ping pong,” and the fourth distinct hub candidate being“foosball.” Pre-processing may additionally involve identifying synonymsof the word or words in each distinct hub candidate, identifying wordsthat may be misspelled, identifying the potentially correct spellings,expanding phrases or adding words to phrases (e.g., words that may havebeen unintentionally left out or left our as a result of brevity),removing URLs, removing metadata, normalizing the word or words based onlanguage (e.g., converting words from the language in which they wereentered into the language typically used by the user, or convertingwords from the language in which they were entered into the language inwhich a best match for the hub candidate is likely to be found), and thelike. As an example and not by way of limitation, consider that a usermay have entered “Godfather I, II, III” in a favorite movies section416. Bootstrapping process 214 may identify that the user has actuallyintended to indicated three movies: The Godfather part I, The Godfatherpart II, and The Godfather part III. In such a case, the bootstrappingprocess 214 may consider each movie as a separate hub candidate asthough the user had explicitly typed out all three movie names.

In particular embodiments, each identified distinct node candidate(e.g., n-gram or string of characters) may then be matched to orcompared with a list of known users nodes 302 or concept nodes 304 (orusers and concept) using one or more of a variety of suitable stringmatching algorithms. In particular embodiments, the known users orconcepts with which the node candidates are compared may be indexed inthe form of a corresponding n-gram or strings of characters and storedin social-graph database 206 or concept database 216. Generally, conceptdatabase 216 may be an indexed repository of concept information thatbootstrapping process 214 can query against for matching candidate hubsto known concepts. That is, in particular embodiments, it is desired tomatch each hub candidate with a single known concept. In particularembodiments, concept database 216 may be populated with known conceptsby crawling one or more external information sources or datarepositories (such as, for example, by crawling WIKIPEDIA(www.wikipedia.org) or FREEBASE (www.freebase.com)) and combining thesecrawling results with each other, as well as, potentially, informationextracted from one or more internal information sources, includingsocial-graph database 206. In particular embodiments, the conceptsindexed and stored in concept database 216 don't necessarily havecorresponding existing concept nodes 304 (or user nodes 302) insocial-graph database 206. That is, concept database 216 may generallystore an index of known concepts (each represented by correspondingcharacter string), as well as information about these concepts (whichmay be crawled from an external data source such as those justdescribed), but not all of these known concepts may have correspondingexisting concept nodes 304 stored in social-graph database 206. Inparticular embodiments, concept database 216 may include social-graphdatabase 206 or vice versa. In particular embodiments, to facilitate thematching of node candidates to known users or concepts indexed insocial-graph database 206 or concept database 216, the index of knownusers or concepts may be organized into categories such as, by way ofexample and not by way of limitation, people, places, things,activities, sports, sports teams, celebrities, cities, locations,movies, books, restaurants, etc. The particular categories searched bybootstrapping process 214 may be determined by a section ID or otherfield identifier associated with where the node candidate wasidentified.

In particular embodiments, as a result of pre-processing, each nodecandidate may have associated with it, one or more n-grams or characterstrings that are each attempted to be matched with known users orconcepts in social-graph database 206 or concept database 216. As anexample and not by way of limitation, the delimited character stringcorresponding to the user's entered text may be matched as well as othercharacter strings in which spelling changes, word additions, workremovals, among other changes have been made. In particular embodiments,bootstrapping process 214 may then identify a “shortlist” of the bestmatching known users or concepts matching the node candidate. Inparticular embodiments, bootstrapping process 214 may then generate ordetermine a confidence score or value for each match in the shortlist(similarly to the confidence score described with reference to thetypeahead processes above). As an example and not by way of limitation,the confidence score for each known user or concept may be based on oneor more of the following: a determination of how well the text in thecharacter string of the node candidate matched the text in the characterstring of each known user or concept, whether the spellings of any ofthe words in the node candidate n-gram or character string were changedto obtain the match, whether any characters or words were added orremoved in the node candidate n-gram or character string to obtain thematch, etc.

In particular embodiments, after a list of potential node candidates areidentified, the list may be narrowed further by using other informationknown about the user. As an example and not by way of limitation, a user“A” may declares “Twilight, Harry Potter” in a favorite movies section416 on the user's profile page. If bootstrapping process 214 could notunambiguously identify the movie corresponding to “Twilight,” (e.g.,because there are multiple movies with the word “twilight”),bootstrapping process 214 may use the fact that many other users wholike “Harry Potter” also like the movie “Twilight: New Moon” (anunambiguous movie), and therefore determine that user “A” is referringto “Twilight: New Moon” (and therefore referring to the concept node 304corresponding to this movie) with a sufficient degree of certainty whenuser “A” has typed “Twilight.” Similarly, bootstrapping process 214could use demographic information about the user. As an example and notby way of limitation, an older user may prefer the 1958 version of“Romeo and Juliet,” whereas a younger user may be more likely to meanthe newer version of “Romeo+Juliet” released in 1996.

In particular embodiments, bootstrapping process 214 may iterativelyre-query the concept database 216 to find matches having the sameconfidence scores as the matches in the previously identified list ofmatches. Second, third, and additional rounds of matching may beperformed in order to reduce or eliminate the possibility of falsepositives. As an example and not by way of limitation, rather thansimply choose the match having the best confidence score, which mayappear high thereby indicating a high level of confidence in the match,by performing the second round of matching, bootstrapping process 214may find that there are numerous matching known users or concepts havingthe same confidence score, thereby signaling the reality that thequality of, or confidence in, the match is misleading and the matchshouldn't be accepted.

In particular embodiments, bootstrapping process 214 may then determinewhether a suitable match to a known user or concept exists for the givennode candidate based on the results determined previously. If it isdetermined that a match exists in social-graph database 206 or conceptdatabase 216, bootstrapping process 214 may then determine whether ornot an existing user node 302 or concept node 304 exists in social-graphdatabase 206. Alternatively, bootstrapping process 214 may attempt tomatch a node candidate to an existing node in social-graph database 206first before resorting to attempting to match the node candidate toknown users or concepts not having corresponding existing nodes insocial-graph database 206.

In particular embodiments, if it is determined that a match cannot befound for the n-gram or character string associated with the nodecandidate, at least according to a desired or predetermined level ofprobability or confidence, bootstrapping process 214 may then determinewhether the node candidate is splittable; that is, whether the n-gram orcharacter string can be split into separate node candidates. As anexample and not by way of limitation, a match from a node candidate to aknown user or concept may not be found for a variety of reasons, thesimplest of which may be that the node candidate is too generic toidentify a known user or concept with confidence, is a common name, isdrastically misspelled or entered wrong, or is considered a “higherorder” concept that, generally, involves a phrase and even two or moreconcepts. As an example and not by way of limitation, a user may havetyped a declaration that, even after pre-processing, results in thehigher order node candidate character string “all movies with JohnnyDepp or Edward Norton.” To facilitate this process, bootstrappingprocess 214 may keep a list of “connector words” such as “and” or “or,”among others. In particular embodiments, if a confident match for acharacter string such as this can't be found, bootstrapping process 214may make the determination as to whether the n-gram or character stringcorresponding to the node candidate is splittable. In particularembodiments, if it is determined that the n-gram or character string issplittable (e.g., bootstrapping process 214 identified connector wordsin the character string), then bootstrapping process 214 may split then-gram or character string into one or more node candidates. For each ofthese split node candidates (e.g., “all movies with Johnny Depp” and“all movies with Edward Norton”), bootstrapping process 214 thenproceeds as before.

In particular embodiments, bootstrapping process 214 may use a secondlist of “common phrase language” that it may use to determine if a nodecandidate is splittable or, more particularly, reducible. As an exampleand not by way of limitation, in the above example, the part of thecharacter string that reads “all movies with” may be identified ascommon phrase language and removed, thereby resulting in the separatenode candidates of simply “Johnny Depp” and “Edward Norton.”

In particular embodiments, recommendation-generating process 218 maydetermine recommended profile pages for a particular user (the“requesting user”) requesting or currently viewing a particular profilepage (the “requesting page”), and further may cause references to therecommended profile pages to be displayed or listed in a recommendationssection of the profile page (such as recommendations section 510illustrated in FIG. 5A). In particular embodiments,recommendation-generating process 218 may determine recommended profilepages based information extracted from social-graph database 206,including information about one or more of: the requesting user, therequested profile page, friends of the user whose user nodes 302 may ormay not also be connected to the requested profile page's node withrespective edges, other profile pages having respective nodes that arealso connected to the requested profile page's node, other suitablesocial-networking data, or any combination thereof. As an example andnot by way of limitation, the recommended profile pages displayed inrecommendations section 510 may include profile pages that are “liked,”“friends,” or otherwise connected (with edges in social-graph database206) to friends of the requesting user (as defined by edges insocial-graph database 206), and particularly friends that are alsoconnected to the requested profile page (with edges in social-graphdatabase 206). As another example and not by way of limitation, therecommended profile pages displayed in recommendations section 510 mayinclude profile pages that users, and particularly friends of therequesting user (as defined by edges in social-graph database 206), also“like” or are otherwise connected to (with edges in social-graphdatabase 206), but who aren't necessarily connected with the requestedprofile page (with edges in social-graph database 206). As yet anotherexample and not by way of limitation, the recommended profile pagesdisplayed in recommendations section 510 may include profile pages thatare connected to the requested profile page (with edges in social-graphdatabase 206) and one or more friends of the requesting user (as definedby edges in social-graph database 206). As yet another example and notby way of limitation, the recommended profile pages displayed inrecommendations section 510 may include profile pages that are connectedto the requested profile page (with edges in social-graph database 206)but that aren't necessarily connected with friends of the requestinguser (as defined by edges in social-graph database 206). Generally, onegoal or motivation for displaying recommended profile pages to therequesting user currently viewing or requesting a particular profilepage is to provide the user with recommended profile pages the user maybe interested in viewing or interacting with and, furthermore,facilitate navigation to such recommended profile pages from thecurrently viewed profile page and, in particular embodiments, tofacilitate the creation of edges 306 connecting the user node 302corresponding to the user to nodes corresponding to the recommendedprofile pages the user demonstrates or indicates an interest in.

In particular embodiments, the method may begin when social-networkingsystem 20 receives a request for a particular profile page (therequested profile page) from a particular user (the requesting user). Inparticular embodiments, in response to the request, social-networkingsystem 20, and particularly page-generating process 200, may generate astructured document for rendering the profile page at the requestinguser's client device 30 and transmits an initial response that includesthe structured document to the requesting user's client device 30. Thestructured document transmitted to the requesting user may be a basestructured document that includes markup language code as well asvarious code segments, scripts, resources, or other information orcontent for serving the requested profile page to the client forrendering by the client's web browser 202. In particular embodiments,the base structured document may include code for rendering one or moreportions of the requested profile page including code for displayingportions of the recommendations section 510, but may not include therecommended profile pages themselves in the form of profile page namesor other identifiers 512 and images 514; that is, in one implementation,social-networking system 20 may transmit the structured document in theinitial response before the recommended profile pages are determined byrecommendation-generating process 218. In this way, the client's webbrowser 202 may start rendering the structured document and downloadingresources for rendering the requested profile page asrecommendation-generating process 218 completes it's determination ofrecommended profile pages.

In particular embodiments, in parallel with or after the generation ofthe base structured document or sending of the initial response,recommendation-generating process 218 may generate recommended profilepages that are then transmitted in one or more subsequent responses tothe requesting user's client device 30 for rendering by the client's webbrowser 202. In particular embodiments, after the request for theprofile page is received by social-networking system 20, page-generatingprocess 200 or other process executing within social-networking system20 may transmit an instruction or query to recommendation-generatingprocess 218 requesting one or more recommended profile pages for displayin recommendations section 510. In particular embodiments, theinstruction or query may include information such as an identifier ofthe user (e.g., a user ID that identifies the requesting user's usernode 302) and an identifier of the requested profile page (e.g., aprofile page ID that identifies the requested profile page's user node302 or concept node 304).

In particular embodiments, in response to the instruction or query,recommendation-generating process 218 may then determine or identify afirst data set that includes profile pages that are each connected (viaedges 306 in social-graph database 206) with one or more users orconcept who are, in turn, each connected with both the requesting user(e.g., friends of the requesting user, concepts liked by the requestinguser) and also connected with the requested profile page (e.g., usersthat also like the requested profile page, concepts liked by friends ofthe requesting user). In particular embodiments, in parallel with orafter determining the first data set, recommendation-generating process218 may determine a second data set that includes profile pages that areeach connected both with the requested profile page (via edges 306 insocial-graph database 206) and also connected with one or more users orconcepts who, in turn, are connected (via edges 306 in social-graphdatabase 206) to the requesting user (e.g., friends of the requestinguser). Generally, the first and second data sets may include one or moreof the same profile pages.

In particular embodiments, social-graph database 206 may include one ormore queryable (searchable) indexes generated by indexing the datawithin social-graph database 206 (alternately, in another embodiment,the indexes may be stored in one or more data stores or databasesoutside of social-graph database 206). In particular embodiments, anindexing process 220 may generate or update the indexes periodically(e.g., hourly, daily, weekly). Additionally, or alternately, the indexesmay be updated dynamically in response to the creation of new nodes ornew edges in social-graph database 206 as well as in response to otheractions (e.g., in response to interactions between users and profilepages or in response to edits made to user-profile pages or hubs). Inparticular embodiments, indexing process 220 may generate a plurality ofindexes to facilitate the determinations. As an example and not by wayof limitation, indexing process 220 may generate and maintain an indexof all registered users that is indexed by user ID (e.g., theidentifiers of the users and respective user nodes 302 in social-graphdatabase 206) and which includes, for each user ID, the set of otherusers identified by their respective user IDs whose respective usernodes 302 are connected to the user node 302 corresponding to theparticular user ID in the index. As another example and not by way oflimitation, indexing process 220 may generate and maintain another indexof all registered users that is again indexed by user ID but whichincludes, for each user ID, the set of hubs or respective concept nodes304 identified by their respective profile page IDs (e.g. theidentifiers of the profile pages and respective concept nodes 304 insocial-graph database 206) that are connected to the user node 302corresponding to the particular user ID in the index. As yet anotherexample and not by way of limitation, indexing process 220 may generateand maintain another index of all the profile pages indexed by profilepage ID and that includes, for each profile page ID, the set of otherprofile pages and respective concept nodes 304 identified by profilepage ID that are connected to the concept node 304 corresponding to theparticular profile page ID in the index. As yet another example and notby way of limitation, indexing process 220 may generate and maintainanother index of all the profile pages indexed by profile page ID andthat includes, for each profile page ID, the set of users and respectiveuser nodes 302 identified by user ID that are connected to the conceptnode 304 corresponding to the particular profile page ID in the index.

In particular embodiments, recommendation-generating process 218 maydetermine the first and second data sets, respectively, by querying theindexes generated by indexing process 220. This may involve queryingindexing process 220 itself or some other process that is configured toreceive queries and return results based on searching one or more of theindexes. As an example and not by way of limitation,recommendation-generating process 218 may determine the first data setby sending a first nested query to indexing process 220 that, in a firstpart or step of the first nested query, instructs indexing process 220to identify all the user IDs corresponding to users who are connected(e.g., friends) with the requesting user. In a second part of the nestedquery, indexing process 220 may be instructed to identify which of theuser IDs identified in the first part correspond to users who are alsoconnected with the requested profile page. In a third part of the firstnested query, indexing process 220 may be instructed to return, torecommendation-generating process 218, the profile page IDscorresponding to the profile pages connected with the user IDsidentified in the second part of the query (but in particularembodiments, excluding those profile page IDs corresponding to profilepages already connected to the requesting user) as well as the user IDsthemselves matched with each of the profile page IDs. In a similarfashion, recommendation-generating process 218 may determine the seconddata set by sending a second nested query to indexing process 220 thatinstructs indexing process to determine all the profile page IDscorresponding to profile pages that are connected with the requestedprofile page and then return, to recommendation-generating process 218,the profile page IDs corresponding to the ones of the identified profilepages that are also connected with one or more users connected with therequesting user (but in particular embodiments, excluding those profilepage IDs corresponding to profile pages already connected to therequesting user) as well as the user IDs themselves matched with each ofthe profile page IDs.

In particular embodiments, the profile page indexes generated byindexing process 220 may be indexed, arranged, or otherwise searchableby profile page category (e.g., user, group, association, movie, music,activity, sport, etc.). In particular embodiments, the profile pagesreturned in the first and second data sets may only include profilepages sharing the same category as the requested profile page. However,in particular embodiments, profile pages of different categories may beincluded in the returned data sets.

In particular embodiments, each of the first and second data sets mayinclude a list or index of profile pages (e.g., identified by profilepage ID) as well as, for each profile page, a set of users (e.g.,identified by user ID) and/or concepts (e.g., identified by concept ID)connected with the respective profile page. Recommendation-generatingprocess 218 may then generate a score for each profile page identifiedin the first and second data sets and subsequently rank the profilepages based on their respective scores to generate a single combined orcorrelated list of ranked profile pages that are candidates (hereinafteralso referred to as “candidate pages”) for recommended profile pages. Inparticular embodiments, recommendation-generating process 218 may scoreeach profile page in each of the first and second data sets based atleast in part on the number of users (i.e., the friends of therequesting user) or concepts (i.e., concepts liked by the requestinguser or his friends) returned with the respective profile page in thefirst or second data sets.

In particular embodiments, recommendation-generating process 218 mayscore the profile pages in each of the first and second data sets andthen combines the resulting scores. As an example and not by way oflimitation, if a profile page in the first set is connected with five ofthe requesting user's friends, that profile page may be assigned a scoreor weight of five by recommendation-generating process 218. Similarly,if a profile page in the second set is connected with four of therequesting user's friends, that profile page may be assigned a score orweight of four by recommendation-generating process 218. In particularembodiments, recommendation-generating process may then generate acombined data set that includes all of the profile pages in each of thefirst and second data sets and combine or correlate the scoring resultsbased on each of the first and second data sets to generate a singlecorrelated score for each of the profile pages in the combined data set.The single correlated scores for the respective candidate pages may thenbe used in ranking the profile pages in the correlated ranked list ofprofile pages. In particular embodiments, the weights assigned to theprofile pages in the first and second data sets are themselves weightedequally by recommendation-generating process 218. As an example and notby way of limitation, a profile page with a weight of five from thefirst data set may be assigned a score of five in the single correlatedranked list. Similarly, a profile page with a weight of four from thesecond data set may be assigned a score of four in the single correlatedranked list. Additionally, as the first and second data sets may sharecommon profile pages, if a profile page returned in both of the firstand second data sets was assigned a weight of six based on the firstdata set and assigned a weight of three based on the second data set,recommendation-generating process 218 may sum the individual weights andassign the profile page a score of nine in the single correlated rankedlist (6+3=9). However, as the friends used to generate the weights maybe shared in the first and second data sets, recommendation-generatingprocess 218 may reduce the combined score to account for this. As anexample and not by way of limitation, continuing the above example,assuming that a profile page found in both data sets also shares twofriends in each data set, the resultant correlated score for the profilepage may be calculated as seven (6+3−2=7). However, in particularembodiments, recommendation-generating process 218 may first combine thefirst and second data sets to generate one combined data set and thenscore each of the profile pages in the resultant combined data set. Inthis way, profile pages and associated users shared between the datasets may be accounted for, if desired, before generating a score for theprofile page.

In particular embodiments, recommendation-generating process 218 maydetermine a score for each profile page in the combined data set basedon factors other than simply the number of the requesting user's friendsconnected with the respective profile page. As an example and not by wayof limitation, recommendation-generating process 218 may query indexingprocess 220 for one or more other data sets. As an example and not byway of limitation, recommendation-generating process 218 may determine athird data set that includes all the profile pages connected with therequested profile page, or all the profile pages that are connected withthe requested profile page and not connected to any of the requestinguser's friends. As another example and not by way of limitation,recommendation-generating process 218 may determine a fourth data setthat includes all of the profile pages connected with the requestinguser's friends, or all of the profile pages connected with therequesting user's friends but not connected to the requested profilepage. These third or fourth data sets may be used in augmenting the datain the first and second data sets or to provide additional criteria(e.g., a global filter that indicates an overall popularity of each ofthe profile pages) with which to score the profile pages in the firstand second data sets. Furthermore, the third and fourth data sets may beparticularly useful in cases in which there are not any friends of theuser that are connected with the requested profile page or in which noneof the profile pages connected with the requested profile page areconnected to any of the requesting user's friends.

In particular embodiments, recommendation-generating process 218 mayweight the profile pages in such third or fourth data sets differentlythan the profile pages in the first and second data sets. As an exampleand not by way of limitation, each profile page in the third or fourthdata sets are weighted according to the total number of user nodes 302connected with the respective profile page's user node 302 or conceptnode 304. However, when combining the first, second, third, and fourthdata sets and calculating a correlated score for each profile page inthe combined data set, the number of total users connected with eachprofile page in the third and fourth data sets may account for a smallercontribution to the single correlated score. As an example and not byway of limitation, if “profile page A” is found in each of the first,second, third, and fourth data sets and is associated with 5 users inthe first data set, 4 non-shared users in the second data set, 50 usersin the third data set, and 75 users in the fourth data set,recommendation-generating process may calculate the correlated score forthe profile page as 5a+4b+50c+75d where a, b, c, and d are the weightswith which the respective number of users are multiplied by. As anexample and not by way of limitation, in one implementation, a=1, b=1,c=0.01, and d=0.01 such that the correlated score for the profile page Ais 5+4+0.5+0.75=10.25.

In particular embodiments, recommendation-generating process 218 maydetermine the single correlated score for each profile page in the firstand second data sets (in some embodiments the profile pages in the thirdand fourth data sets that are not also in one or more of the first andsecond data sets are not scored) by summing or otherwise combining, foreach profile page in the combined data set, a number of coefficientscores that are, in turn, generated for each profile page in thecombined data set and each user connected with the respective profilepage. In particular embodiments, a coefficient score in this senserefers to the strength of the connection (as defined or represented byan edge 306) or plurality of connections. The coefficient scoresgenerated by recommendation-generating process 218 for a particularprofile page and associated users may be based on various factors, suchas, for example, the relationship of the user to the profile page; therelationship of the user to the requesting user (e.g., friend, relative,spouse, etc.); a level or frequency of interaction between the profilepage and the user (e.g., how many times the user views the profile pageor how much content was added to the profile page by the user over aperiod of time); a level or frequency of interaction between the userand the requesting user (e.g., how times the users viewed one another'sprofile pages or how many times the users posted comments, wall (feed)postings, sent messages, or otherwise interacted with one another'sprofile pages over a period of time); the number of user nodes 302,concept nodes 304, or total nodes connected to both the profile page andthe user, or connected to both the user and the requesting user, orconnected to both the profile page and the requested profile page, orconnected to both the profile page and the requested user; the quantityor quality of shared content between the profile page and the requestedprofile page, other suitable factors, or any combination thereof. As anexample and not by way of limitation, determining a single correlatedscore for each profile page in the combined data set may involverecommendation-generating process 218 generating one or more coefficientscores between each profile page in the combined data set and each ofthe requesting user's friends connected to the respective profile page,one or more coefficient scores between each profile page in the combineddata set and the requesting user, one or more coefficient scores betweeneach profile page in the combined data set and the requested profilepage, or one or more coefficient scores between the requesting user andeach of the users connected with a profile page from the combined dataset. Determining a single correlated score for each profile page in thecombined data set may additionally involve summing or otherwisecombining each of the coefficient scores to generate the singlecorrelated score for each profile page.

In particular embodiments, in order to calculate coefficient scores andsubsequently single correlated scores for each of the profile pages inthe combined data set, the data results returned in the first and seconddata sets (and in some embodiments the third and fourth data sets aswell) may be first sent by recommendation-generating process (ordirectly from indexing process 220) to a data mining system such as, forexample, HIVE (a data warehouse infrastructure built on top of HADOOP)where HADOOP then runs or executes a number of MapReduce jobs orprocesses on the data to generate the coefficient scores which are thenused by recommendation-generating process 218 to generate the singlecorrelated scores for each profile page.

In particular embodiments, recommendation-generating process 218 mayrank the profile pages by their respective correlated scores andgenerates a ranked list of profile pages (e.g., a ranked list of profilepage IDs) with the profile pages having the highest correlated scoresrepresenting the most relevant profile pages. In particular embodiments,recommendation-generating process 218 may then select the top x (e.g.,four in the example illustrated in FIG. 5A) profile pages having thehighest correlated scores as the recommended profile pages to bedisplayed in recommendations section 510.

In particular embodiments, recommendation-generating process 218 maythen communicate the profile page IDs of the recommended profile pagesto page-generating process 200 or other process that then generates codeincluding, for example, HTML or other markup language code as well as,in some embodiments, various other code segments or resources including,for example, image resources for use in rendering the recommendedprofile page names 512 or images 514 in recommendations section 510, andin some embodiments, code segments for implementing hyperlinks thatdirect the user to a recommended profile page upon clicking or otherwiseselecting a recommended profile page name text field 512 or profile pageimage 514. The code and resources may then be sent to the user's clientdevice 30 in a subsequent response for rendering by the client's webbrowser 202. In particular embodiments, the subsequent response is sentusing AJAX or other asynchronous techniques as the base structureddocument for rendering the requested profile page may have already beensent in an initial response. In particular embodiments,social-networking system 20 may wait for recommendation-generatingprocess 218 to provide the profile page IDs of the recommended profilepages and includes the code or resources for displaying the recommendedprofile page names 512 or profile page images 514 with the rest of thestructured document for rendering the profile page at the client device30 prior to sending the structured document to the requesting user.

In particular embodiments, code for rendering node names (e.g., text)516 or node images 518 (e.g., user-profile pictures, avatars, orconcept-profile pictures) of a select subset of the users or nodesconnected with each of the recommended profile pages and the requestinguser is also sent with the subsequent response for rendering and displaynext to the respective recommended profile page in recommendationssection 510. Additionally or alternately, the subsequent response sentmay include code for displaying a text string for each of therecommended profile pages in proximity to the respective recommendedprofile page that reads, for example, “n of your friends also likethis,” where n is the number of the requesting user's friends that areconnected to the respective recommended profile page or “these friendsalso like this,” where “these friends” are represented by the node names516 or node images 518 displayed next to the respective recommendedprofile page, or “n of your friends also like this including:”.

In particular embodiments, wall (or news feed/activities feed) section501 a, or other feed or activities section of the profile page, maydisplay comments, status updates, wall posts, or other user activitiesassociated with the user and friends of the user that are viewing theprofile page. The wall (or news feed/activities feed) section 501 a, orother feed or activities section of the profile page may also displaycomments, status updates, wall posts, or other user activities and usergenerated content that are related to the concept for which the profilepage was created as well as, in some embodiments, the users/conceptsassociated with the recommended profile pages determined for thecurrently requested or viewed profile page. Recommendation-generatingprocess 218 may perform a search on comments, status updates, wall postsand other user-generated content and user activities associated with therequesting user and friends of the requesting user filtered by user orconcept; that is, a keyword search for keywords related to the user orconcept of the currently requested or viewed profile page (andpotentially keywords related to the users or concepts associated withthe recommended profile pages) in these streams of user feeds oractivities related to the requesting user and the requesting user'sfriends, and display this subset of user content or activities in thewall or feed section of the currently requested or viewed profile page.

Structured Search Queries

In particular embodiments, a user of an online social network may searchfor information relating to a specific subject matter (e.g., users,concepts, external content or resource) by providing a short phrasedescribing the subject matter, often referred to as a “search query,” toa search engine. The search engine may conduct a search based on thequery phrase using various search algorithms and generate search resultsthat identify resources or content (e.g., user-profile pages,content-profile pages, or external resources) that are most likely to berelated to the search query. To conduct a search, a user may input ortransmit a search query to the search engine. In response, the searchengine may identify one or more resources that are likely to be relatedto the search query, which may collectively be referred to as a “searchresult” identified for the search query. The search results may bepresented to the user, often in the form of a list of links onsearch-results webpage, each link being associated with a differentwebpage that contains some of the identified resources or content. Inparticular embodiments, each link in the search results may be in theform of a Uniform Resource Locator (URL) that specifies where thecorresponding webpage is located and the mechanism for retrieving it.The user may then be able to click on the URL links to view the specificresources or contents contained in the corresponding webpages as he orshe wishes. The resources may be ranked and presented to the useraccording to their relative degrees of relevance to the search query.The search results may also be ranked and presented to the useraccording to their relative degree of relevance to the user. In otherwords, the search results may be personalized for the querying userbased on, for example, social-graph information, user information,search or browsing history of the user, or other suitable informationrelated to the user. In particular embodiments, ranking of the resourcesmay be determined by a ranking algorithm implemented by the searchengine. As an example and not by way of limitation, resources that arerelatively more relevant to the search query or to the user may beranked higher than the resources that are relatively less relevant tothe search query or the user. In particular embodiments, the searchengine may limit its search to resources and content on the onlinesocial network. However, in particular embodiments, the search enginemay also search for resources or contents on other sources, such asweb-application server 40, enterprise server 50, the internet or WorldWide Web, or other suitable sources.

In particular embodiments, the typeahead processes described herein maybe applied to search queries entered by a user. As an example and not byway of limitation, as a user enters text characters into the searchfield 450, the frontend-typeahead process 204 and/or thebackend-typeahead processes 208 may attempt to identify existing usernodes 302, concept nodes 304, or edges 306 that match the string ofcharacters entered search field 450 as the user is entering thecharacters. As the backend-typeahead process 208 receives requests orcalls including a string or n-gram from the text query, the backendprocess 208 may perform or causes to be performed a search to identifyexisting social-graph elements (i.e., user nodes 302, concept nodes 304,edges 306) having respective names, types, categories, or otheridentifiers matching the entered text. The backend-typeahead process 208may use one or more matching algorithms to attempt to identify matchingnodes or edges. When a match or matches are found, the backend-typeaheadprocess 208 may transmit a response to the user's client device 30 thatmay include, for example, the names (name strings) of the matching nodesas well as, potentially, other metadata associated with the matchingnodes. The frontend-typeahead process 204 may then display a drop-downmenu (such as, for example, drop-down menu 600 illustrated in FIGS.6A-6R) that displays names of matching existing profile pages andrespective user nodes 302 or concept nodes 304, and displays names ofmatching edges 306 that may connect to the matching user nodes 302 orconcept nodes 304, which the user can then click on or otherwise selectthereby confirming the desire to search for the matched user or conceptname corresponding to the selected node, or to search for users orconcepts connected to the matched users or concepts by the matchingedges. Alternatively, the frontend-typeahead process 204 may simplyauto-populate the form with the name or other identifier of thetop-ranked match rather than display a drop-down menu. The user may thenconfirm the auto-populated declaration simply by keying “enter” on hisor her keyboard or by clicking on the auto-populated declaration. Uponuser confirmation of the matching nodes and edges, thefrontend-typeahead process 204 may transmit a request to thebackend-typeahead process 208 that informs the backend-typeahead processof the user's confirmation of a query containing the matchingsocial-graph elements. In response to the request transmitted, thebackend-typeahead process may automatically (or alternately based on aninstruction in the request) call or otherwise instruct thesocial-networking system 20 to search the social-graph database 206 forthe matching social-graph elements, or for social-graph elementsconnected to the matching social-graph elements as appropriate. Althoughthis disclosure describes applying the typeahead processes to searchqueries in a particular manner, this disclosure contemplates applyingthe typeahead processes to search queries in any suitable manner.

FIGS. 6A-6R illustrate example queries of the social network. Inparticular embodiments, the social-networking system 20 may generate oneor more structured queries comprising references to one or moreidentified social-graph elements in response to a text query receivedfrom a first user (i.e., the querying user). FIGS. 6A-6R illustratevarious example text queries in query fields 450 and various structuredqueries generated in response in drop-down menus 600. By providingsuggested structured queries in response to a user's text query, thesocial-networking system 20 may provide a powerful way for users of theonline social network to search for elements represented in the socialgraph 300 based on their social-graph attributes and their relation tovarious social-graph elements. Structured queries may allow a queryinguser to search for content that is connected to particular users orconcepts in the social graph 300 by particular edge types. As an exampleand not by way of limitation, the social-networking system 20 mayreceive a substantially unstructured text query from a first user. Inresponse, the social-networking system 20 (via, for example, aserver-side element detection process) may access the social graph 300and then parse the text query to identify social-graph elements thatcorresponding to n-grams from the text query. The social-networkingsystem 20 may identify these corresponding social-graph elements bydetermining a probability for each n-gram that it corresponds to aparticular social-graph element. Social-graph elements with aprobability greater than a threshold probability may be identified andthen referenced in one or more structured queries generated by thesocial-networking system 20. The structured queries may then betransmitted to the first user and displayed in a drop-down menu 100(via, for example, a client-side typeahead process), where the firstuser can then select an appropriate query to search for the desiredcontent. After the first user selects a particular structured query, thesocial-networking system 20 may process the query to identify targetnodes corresponding to the query. These target nodes may then befiltered based on privacy settings associated with the nodes (via, forexample, a server-side privacy-filter process), and the filtered resultsmay then be transmitted to the first user as search results. Some of theadvantages of using the structured queries described herein includefinding users of the online social networking based upon limitedinformation, bringing together virtual indexes of content from theonline social network based on the relation of that content to varioussocial-graph elements, or finding content related to you and/or yourfriends. Although this disclosure describes and FIGS. 6A-6R illustrategenerating particular structured queries in a particular manner, thisdisclosure contemplates generating any suitable structured queries inany suitable manner.

Element Detection

In particular embodiments, social-networking system 20 may receive froma querying/first user (corresponding to a first user node 302) asubstantially unstructured text query. As an example and not by way oflimitation, a first user may want to search for other users who: (1) arefirst-degree friends of the first user; (2) “like” the company FACEBOOK(i.e., the user nodes 302 are connected by an edge 306 to the conceptnode 304 corresponding to the company FACEBOOK INC.); and (3) areyounger than a certain age. The first user may then enter a text query“friends who like facebook and are younger than” into search field 450,as illustrated in FIGS. 6C-6I. As another example and not by way oflimitation, the first user may want to search for other users who: (1)“like” the location “Old Pro”; (2) “like” the company “Acme; and (3)live in the city of Palo Alto. The first user may then enter a textquery “people who like old pro and acme in palo alto” into search field450, as illustrated in FIGS. 6K-6O. In both of the examples describedabove, as the first user enters this text query into search field 450,the social-networking system 20 may provide various suggested structuredqueries, as illustrated in drop-down menus 600. As used herein, asubstantially unstructured text query refers to a simple text stringinputted by a user. The text query may, of course, be structured withrespect to standard language/grammar rules. However, the text query willordinarily be unstructured with respect to social-graph elements. Inother words, a simply text query will not ordinarily include embeddedreferences to particular social-graph elements. Thus, as used herein, astructured query refers to a query that contains references toparticular social-graph elements, allowing the search engine to searchbased on the identified elements. Although this disclosure describesreceiving particular queries in a particular manner, this disclosurecontemplates receiving any suitable queries in any suitable manner.

In particular embodiments, social-networking system 20 may parse thesubstantially unstructured text query (also simply referred to as asearch query) received from the first user (i.e., the querying user) toidentify one or more n-grams. In general, an n-gram is a contiguoussequence of n items from a given sequence of text or speech. The itemsmay be characters, phonemes, syllables, letters, words, base pairs,prefixes, or other identifiable items from the sequence of text orspeech. The n-gram may comprise one or more characters of text (letters,numbers, punctuation, etc.) entered by the querying user. An n-gram ofsize one can be referred to as a “unigram,” of size two can be referredto as a “bigram” or “digram,” of size three can be referred to as a“trigram,” and so on. Each n-gram may include one or more parts from thetext query received from the querying user. In particular embodiments,each n-gram may comprise a character string (e.g., one or morecharacters of text) entered by the first user. As an example and not byway of limitation, the social-networking system 20 may parse the textquery “friends in palo alto” to identify the following n-grams: friends;in; palo; alto; friends in; in palo; palo alto; friend in palo; in paloalso; friends in palo alto. In particular embodiments, each n-gram maycomprise a contiguous sequence of n items from the text query. Asanother example and not by way of limitation, the social-networkingsystem 20 may parse the text query “friends who like facebook” (asillustrated in FIG. 6F) to identify the following n-grams: friends; who;like; facebook; friends who; who like; like facebook; friends who like;who like facebook. Although this disclosure describes parsing particularqueries in a particular manner, this disclosure contemplates parsing anysuitable queries in any suitable manner.

In particular embodiments, the social-networking system 20 may parseeach text query and extract one or more n-grams that have beenpredetermined to correspond to particular social-graph elements. Notethat not every word in a search query may represent a predeterminedelement. Particular embodiments may ignore those n-grams that do notrepresent any predetermined query elements. As an example and not by wayof limitation, the social-networking system 20 may receive a searchquery containing “friends who like facebook,” as illustrated in FIG. 6F.The unigram “friends” may have been predetermined to correspond to any“friend” edges 306 connecting the querying user to his first-degreefriends (i.e., other user nodes 302 within one-degree of separation ofthe user node 302 corresponding to the querying user) in the socialgraph 300. Similarly, the n-gram “like” may have been predetermined tocorrespond to any “like” edges 306 connecting to concept nodes 304 inthe social graph 300. Finally, the n-gram “facebook” may have beenpredetermined to correspond to the concept node 304 for the companyFACEBOOK INC. As another example and not by way of limitation, if thesocial-networking system 20 received a search query containing “DoctorYeites Ziltzer,” there may not be a predetermined elements for a titleor a position. Thus, the unigram “doctor” may not represent anysocial-graph element (though it may represent an attribute or propertyof a particular social-graph element, and be searchable on that basis).On the other hand, there may be a predetermined element for a person'sname. Thus, the n-gram “Yeites Ziltzer,” may represent a query elementcorresponding to a particular user node 302 for a user named YeitesZiltzer. An n-gram that does not represent any predetermined element maybe marked as representing null element or otherwise not corresponding toa particular social-graph element. Although this disclosure describesparsing particular search queries in a particular manner, thisdisclosure contemplates parsing any suitable search queries in anysuitable manner.

In particular embodiments, social-networking system 20 may determine orcalculate, for each n-gram identified in the text query, a score thatthe n-gram corresponds to a social-graph element. The score may be, forexample, a confidence score, a probability, a quality, a ranking,another suitable type of score, or any combination thereof. As anexample and not by way of limitation, the social-networking system 20may determine a probability score (also referred to simply as a“probability”) that the n-gram corresponds to a social-graph element,such as a user node 302, a concept node 304, or an edge 306 of socialgraph 300. The probability score may indicate the level of similarity orrelevance between the n-gram and a particular social-graph element.There may be many different ways to calculate the probability. Thepresent disclosure contemplates any suitable method to calculate aprobability score for an n-gram identified in a search query. Inparticular embodiments, the social-networking system 20 may determine aprobability, p, that an n-gram corresponds to a particular social-graphelement. The probability, p, may be calculated as the probability ofcorresponding to a particular social-graph element, k, given aparticular search query, X. In other words, the probability may becalculated as p=(k|X). As an example and not by way of limitation, aprobability that an n-gram corresponds to a social-graph element maycalculated as an probability score denoted as p_(i,j,k). The input maybe a text query X=(x₁, x₂, . . . , x_(N)), and a set of classes. Foreach (i:j) and a class k, the social-networking system 20 may computep_(i,j,k)=p(class(x_(i:j))=k|X). In particular embodiments, thesocial-networking system 20 may determine the probability that aparticular n-gram corresponds to a social-graph element based on alanguage model. Any suitable probabilistic language model may be used todetermine the probability that a particular n-gram corresponds to aparticular social-graph element. As an example and not by way oflimitation, the social-networking system 20 may use an n-gram model, asegmental Markov model, a grammar-language model, another suitableprobabilistic language model, or any combination thereof. In particularembodiments, the social-networking system 20 may user a forward-backwardalgorithm to determine the probability that a particular n-gramcorresponds to a particular social-graph element. For a given n-gramwithin a text query, the social-networking system 20 may use both thepreceding and succeeding n-grams to determine which particularsocial-graph elements correspond to the given n-gram. In particularembodiments, the social-networking system 20 may determine theprobability that a particular n-gram corresponds to a social-graphelement based on advertising sponsorship. An advertiser (such as, forexample, the user or administrator of a particular profile pagecorresponding to a particular node) may sponsor a particular node suchthat the node is given a higher probability when determining whether iscorresponds to particular n-grams, or may even be identified ascorresponding to particular n-grams regardless of the determinedprobability. As an example and not by way of limitation, the n-gram“smart phone” may correspond to a concept node 304 for “iPhone” (whichis a type of smart phone) and may also correspond to a concept node for“Android” (which is another type of smart phone). If one of theseconcept nodes 304 is sponsored by an advertiser, then thesocial-networking system 20 may determine a higher probability of then-gram corresponding to the “smart phone” n-gram. Although thisdisclosure describes determining whether n-grams correspond tosocial-graph elements in a particular manner, this disclosurecontemplates determining whether n-grams correspond to social-graphelements in any suitable manner. Moreover, although this disclosuredescribes determining whether an n-gram corresponds to a social-graphelement using a particular type of score, this disclosure contemplatesdetermining whether an n-gram corresponds to a social-graph elementusing any suitable type of score.

In particular embodiments, the social-networking system 20 may determinethe probability that a particular n-gram corresponds to a social-graphelement based social-graph information. As an example and not by way oflimitation, when determining a probability, p, that an n-gramcorresponds to a particular social-graph element, the calculation of theprobability may also factor in social-graph information. Thus, theprobability of corresponding to a particular social-graph element, k,given a particular search query, X, and social-graph information, G, maybe calculated as p=(k|X,G). In particular embodiments, the probabilitythat an n-gram corresponds to a particular node may be based on thedegree of separation between the first user node 302 and the particularnode. A particular n-gram may have a higher probability of correspondingto a social-graph element that is closer in the social graph 300 to thequerying user (i.e., fewer degrees of separation between the element andthe first user node 302) than a social-graph element that is furtherfrom the user (i.e., more degrees of separation). As an example and notby way of limitation, referencing FIG. 3, if user “B” inputs a textquery of “chicken,” the calculated probability that this corresponds tothe concept node 304 for the recipe “Chicken Parmesan,” which isconnected to user “B” by an edge 306, may be higher than the calculatedprobability that this n-gram corresponds to other nodes associated withthe n-gram chicken (e.g., concept nodes 304 corresponding to “chickennuggets,” or “funky chicken dance”) that are not connected to user “B”in the social graph 300. In particular embodiments, thesocial-networking system 20 may only determine the probability that aparticular n-gram corresponds to node within a threshold degree ofseparation of the user node 302 corresponding to the first user (i.e.,the querying user). Thus, nodes beyond the threshold degree ofseparation may be assigned a zero or null probability of correspondingto the n-gram. Alternatively, when resolving queries, thesocial-networking system 20 may only access nodes within the thresholddegree of separation and only determine probabilities for those nodes.The threshold degree of separation may be, for example, one, two, three,or all. In particular embodiments, the probability that an n-gramcorresponds to a particular node may be based on the identified edges306 connected to the particular node. If the social-networking system 20has already identified one or more edges that correspond to n-grams in areceived text query, those identified edges may then be considered whendetermining whether particular nodes correspond to particular n-grams inthe text query. Nodes that are not connected to any of the identifiededges may be assigned a zero or null probability of corresponding to then-gram. As an example and not by way of limitation, if a user searchesfor “friends who have played poker,” the social-networking system 20 mayidentify that the n-gram “have played” corresponds to “played” edges 306in the social-graph 300, and then search for nodes connected to one ormore “played” edges 306. Continuing with this example, the social-graph300 may contain a concept node 304 corresponding to the application“online poker,” as illustrated in FIG. 3, which can be played online byusers of the online social network (thus forming a “played” edge), andmay also contain a concept node 304 corresponding to the book “Poker forDummies,” which can be “read” or “liked” by users of the online socialnetwork (such as, for example, by indicating as much on theconcept-profile page corresponding to the book). When determining theprobability that either of these nodes corresponds to the n-gram“poker,” the social-networking system 20 may determine that the conceptnode 304 for “online poker” has relatively high probability ofcorresponding to the n-gram “poker” because it is connected to a“played” edge 306, while a concept node 304 for “Poker for Dummies” hasa relatively low probability of corresponding to the n-gram “poker”because it is not connected to any “played” edges 306. In particularembodiments, the probability that an n-gram corresponds to a particularnode may be based on the number of edges 306 connected to the particularnode. Nodes with more connecting edges 306 may be more popular and morelikely to be a target of a search query. As an example and not by way oflimitation, continuing with the prior example, if the concept node 304for “online poker” is only connected by five edges while the conceptnode 304 for “Poker for Dummies” is connected by five-thousand edges,when determining the probability that the n-gram “poker” corresponds toeither of these nodes, the social-networking system 20 may determinethat the concept node 304 for “Poker for Dummies” has a relativelyhigher probability of corresponding to the n-gram “poker” because of thegreater number of edges connected to that concept node 304. Inparticular embodiments, the probability that an n-gram corresponds to aparticular node may be based on the search history associate with thefirst user (i.e., the querying user). Nodes that the first user haspreviously accessed, or are relevant to the nodes the first user haspreviously accessed, may be more likely to be the target of the firstuser's search query. As an example and not by way of limitation,continuing with the prior example, if first user has previously visited“online poker” profile page but has never visited the “Poker forDummies” profile page, when determining the probability that the n-gram“poker” corresponds to either of the nodes corresponding to these pages,the social-networking system 20 may determine that the concept node 304for “online poker” has a relatively higher probability of correspondingto the n-gram “poker” because the querying user has previously accessedthat concept node 304 (and may in fact already be connected to that nodewith a “viewed” edge 306). As another example and not by way oflimitation, if the first user has previously visited the concept-profilepage for the “Facebook Culinary Team,” when determining the probabilitythat the n-gram “facebook” corresponds to a particular social-graphelement, the social-networking system 20 may determine that the conceptnode 304 corresponding to the “Facebook Culinary Team” has a relativelyhigh probability because the querying user has previously accessed theconcept node 304. Although this disclosure describes determining whethern-grams correspond to social-graph elements in a particular manner, thisdisclosure contemplates determining whether n-grams correspond tosocial-graph elements in any suitable manner.

In particular embodiments, the social-networking system 20 may determinethe probability that a particular n-gram corresponds to a social-graphelement based on the relevance of the social-graph element to thequerying user (i.e., the first user, corresponding to a first user node302). User nodes 302 and concept nodes 304 that are connected to thefirst user node 302 directly by an edge 306 may be considered relevantto the first user. As an example and not by way of limitation, a conceptnode 304 connected by an edge 306 to a first user node 302 may beconsidered relevant to the first user node 302. As used herein, whenreferencing a social graph 300 the term “connected” means a path existswithin the social graph 300 between two nodes, wherein the path maycomprise one or more edges 306 and zero or more intermediary nodes. Inparticular embodiments, nodes that are connected to the first user node302 via one or more intervening nodes (and therefore two or more edges306) may also be considered relevant to the first user. Furthermore, inparticular embodiments, the closer the second node is to the first usernode, the more relevant the second node may be considered to the firstuser node. That is, the fewer edges 306 separating the first user node302 from a particular user node 302 or concept node 304 (i.e., the fewerdegrees of separation), the more relevant that user node 302 or conceptnode 304 may be considered to the first user. As an example and not byway of limitation, as illustrated in FIG. 3, the concept node 304corresponding to the location “Old Pro” is connected to the user node302 corresponding to User “B,” and thus the concept “Old Pro” may beconsidered relevant to User “B.” As another example and not by way oflimitation, the concept node 304 corresponding to “SPOTIFY” is connectedto the user node 302 corresponding to User “B” via one intermediate nodeand two edges 306 (i.e., the intermediated user node 302 correspondingto User “C”), and thus the concept “SPOTIFY” may be considered relevantto User “B,” but because the concept node 304 for “SPOTIFY” is asecond-degree connection with respect to User “B,” that particularconcept node 304 may be considered less relevant than a concept node 304that is connected to the user node for User “B” by a single edge 306,such as, for example, the concept node 304 corresponding to the movie“Shawshank Redemption.” As yet another example and not by way oflimitation, the concept node for “Online Poker” (which is an onlinemultiplayer game) is not connected to the user node for User “B” by anypathway in social graph 300, and thus the concept “Online Poker” may notbe considered relevant to User “B.” In particular embodiments, a secondnode may only be considered relevant to the first user if the secondnode is within a threshold degree of separation of the first user node302. As an example and not by way of limitation, if the threshold degreeof separation is three, then the user node 302 corresponding to User “D”may be considered relevant to the concept node 304 corresponding to therecipe “Chicken Parmesan,” which are within three degrees of each otheron social graph 300 illustrated in FIG. 3. However, continuing with thisexample, the concept node 304 corresponding to the application “AllAbout Recipes” would not be considered relevant to the user node 302corresponding to User “D” because these nodes are four degrees apart inthe social graph 300. Although this disclosure describes determiningwhether particular nodes are relevant to each other in a particularmanner, this disclosure contemplates determining whether any suitablenodes are relevant to each other in any suitable manner. Moreover,although this disclosure describes determining whether user nodes 302and concept nodes 304 are relevant to a first user nodes 302, thisdisclosure contemplates similarly determining whether any particularnode is relevant to any other particular node. As an example and not byway of limitation, social graph 300 may be used to determine whichconcept nodes 304 are relevant to other concept nodes 304.

In particular embodiments, the social-networking system 20 may place oneor more constraints when determining whether an n-gram corresponds to aparticular social-graph element. As an example and not by way oflimitation, the social-networking system 20 may only identify user nodes302 where the name of the user corresponding to the user node 302exactly matches a text query. In general, a search query containing aperson's name typically should have an exact match in a particularuser-profile page for that particular user-profile page to be consideredto contain the person's name (after accounting for name variations, suchas nicknames, short names, diminutives, etc.). This may be representedas a proximity constraint where the n-gram representing a person's namein the search query should locate next to each other in a user-profilepage and in the same order as they appear in the search query in orderfor the user-profile page to be considered to contain the person's name.Thus, with respect to query words “Colin Lee Baker” that represent thename of a user of the online social network, the user-profile pageillustrated in FIG. 4A contains the user's name, while otheruser-profile pages associated with other users would not (assuming thereare no other users or concepts named Colin Lee Baker). Otheruser-profile pages may contain all three words of the search query (forexample, a person named Colin Lee who works as a baker), but those wordsmay not necessarily appear in the same order as they appear in thesearch query. Thus, other user-profile pages containing the same wordswould not satisfy the proximity constraint required for the query wordsrepresenting a query for a user node 302. In this case, the searchengine may only reference user nodes 302 where the correspondinguser-profile pages include the words “Colin Lee Baker” in that order.Although this disclosure describes placing particular constraints ondetermining whether particular n-grams correspond to particularsocial-graph elements, this disclosure contemplates placing any suitableconstraints on determining whether any suitable n-grams correspond toany suitable social-graph elements.

In particular embodiments, social-networking system 20 may identify oneor more edges 306 having a probability greater than an edge-thresholdprobability. Each of the identified edges 306 may correspond to at leastone of the n-grams. As an example and not by way of limitation, then-gram may only be identified as corresponding to an edge k ifp_(i,j,k)>p_(edge-threshold). Furthermore, each of the identified edges306 may be connected to at least one of the identified nodes (describedbelow). In other words, the social-networking system 20 may onlyidentify edges 306 or edge-types that are connected to user nodes 302 orconcept nodes 304 that have previously been identified as correspondingto a particular n-gram. Edges 306 or edge-types that are not connectedto any previously identified node are typically unlikely to correspondto a particular n-gram in a search query. By filtering out or ignoringthese edges 306 and edge-types, the social-networking system 20 may moreefficiently search the social graph for relevant social-graph elements.As an example and not by way of limitation, referencing FIG. 3, for atext query containing “went to Stanford,” where an identified conceptnode 304 is the school “Stanford,” the social-networking system 20 mayidentify the edges 306 corresponding to “worked at” and the edges 306corresponding to “attended,” both of which are connected to the conceptnode 304 for “Stanford.” Thus, the n-gram “went to” may be identified ascorresponding to these edges 306. However, for the same text query, thesocial-networking system 20 may not identify the edges 306 correspondingto “like” or “fan” in the social graph 300 because the “Stanford” nodedoes not have any such edges connected to it.]. Although this disclosuredescribes identifying edges 306 that corresponding to n-grams in aparticular manner, this disclosure contemplates identifying edges 306that corresponding to n-grams in any suitable manner.

In particular embodiments, social-networking system 20 may identify oneor more user nodes 302 or concept nodes 304 having a probability greaterthan a node-threshold probability. Each of the identified nodes maycorrespond to at least one of the n-grams. As an example and not by wayof limitation, the n-gram may only be identified as corresponding to anode k if p_(i,j,k)>p_(node-threshold). Furthermore, each of theidentified user nodes 302 or concept nodes 304 may be connected to atleast one of the identified edges 306 (described above). In other words,the social-networking system 20 may only identify nodes or nodes-typesthat are connected to edges 306 that have previously been identified ascorresponding to a particular n-gram. Nodes or node-types that are notconnected to any previously identified edges 306 are typically unlikelyto correspond to a particular n-gram in a search query. By filtering outor ignoring these nodes and node-types, the social-networking system 20may more efficiently search the social graph for relevant social-graphelements. As an example and not by way of limitation, for a text querycontaining “worked at Apple,” where an identified edge 306 is “workedat,” the social-networking system 20 may identify the concept node 304corresponding to the company APPLE, INC., which may have multiple edges306 of “worked at” connected to it. However, for the same text query,the social-networking system 20 may not identify the concept node 304corresponding to the fruit-type “apple,” which may have multiple “like”or “fan” edges connected to it, but no “worked at” edge connections. Inparticular embodiments, the node-threshold probability may differ foruser nodes 302 and concept nodes 304. The n-gram may be identified ascorresponding to a user node 302 k_(user) if p_(user-node-threshold),while the n-gram may be identified as corresponding to a concept node304 k_(concept) if p_(i,j,k)>p_(concept-node-threshold). In particularembodiments, the social-networking system 20 may only identify nodesthat are within a threshold degree of separation of the user node 302corresponding to the first user (i.e., the querying user). The thresholddegree of separation may be, for example, one, two, three, or all.Although this disclosure describes identifying nodes that correspondingto n-grams in a particular manner, this disclosure contemplatesidentifying nodes that corresponding to n-grams in any suitable manner.

In particular embodiments, social-networking system 20 may generate oneor more structured queries that each comprise references to one or moreof the identified edges 306 and one or more of the identified nodes.Generating structured queries is described more below.

FIG. 7 illustrates an example method 700 for detecting social graphelements for structured search queries. The method may begin at step710, where the social-networking system 20 may access a social graph 300comprising a plurality of nodes and a plurality of edges 306 connectingthe nodes. The nodes may comprise a first user node 302 and a pluralityof second nodes (one or more user nodes 302, concepts nodes 304, or anycombination thereof). At step 720, the social-networking system 20 mayreceive from the first user a substantially unstructured text query. Atstep 730, the social-networking system 20 may parse the text query toidentify one or more n-grams. At step 740, the social-networking system20 may determine a probability for each n-gram that the n-gramcorresponds to an edge 306 or a second node. At step 750, thesocial-networking system 20 may identify one or more edges 306 having aprobability greater than an edge-threshold probability. Each of theidentified edges 306 may correspond to at least one of the n-grams. Atstep 760, the social-networking system 20 may identify one or moresecond nodes having a probability greater than a node-thresholdprobability. Each of the identified second nodes may be connected to atleast one of the identified edges 306. Furthermore, each of theidentified second nodes may correspond to at least one of the n-grams.At step 770, the social-networking system 20 may generate one or morestructured queries. Each structured query may include references to oneor more of the identified edges 306 and one or more of the identifiedsecond nodes. Particular embodiments may repeat one or more steps of themethod of FIG. 7, where appropriate. Although this disclosure describesand illustrates particular steps of the method of FIG. 7 as occurring ina particular order, this disclosure contemplates any suitable steps ofthe method of FIG. 7 occurring in any suitable order. Moreover, althoughthis disclosure describes and illustrates particular components,devices, or systems carrying out particular steps of the method of FIG.7, this disclosure contemplates any suitable combination of any suitablecomponents, devices, or systems carrying out any suitable steps of themethod of FIG. 7.

Structured Search Queries

In particular embodiments, social-networking system 20 may generate oneor more structured queries that each comprise references to one or moreof the identified user nodes 302 and one or more of the identified edges306. This type of structured search query may allow thesocial-networking system 20 to more efficiently search for resources andcontent related to the online social network (such as, for example,profile pages) by searching for content connected to or otherwiserelated to the identified user nodes 302 and the identified edges 306.As an example and not by way of limitation, in response to the textquery, “show me friends of my girlfriend,” the social-networking system20 may generate a structured query “Friends of Stephanie,” where“Friends” and “Stephanie” in the structured query are referencescorresponding to particular social-graph elements. The reference to“Stephanie” would correspond to a particular user node 302, while thereference to “friends” would correspond to “friend” edges 306 connectingthat user node 302 to other user nodes 302 (i.e., edges 306 connectingto “Stephanie's” first-degree friends). When executing this structuredquery, the social-networking system 20 may identify one or more usernodes 302 connected by “friend” edges 306 to the user node 302corresponding to “Stephanie.” In particular embodiments, thesocial-networking system 20 may generate a plurality of structuredqueries, where the structured queries may comprise references todifferent identified user nodes 302 or different identified edges 306.As an example and not by way of limitation, in response to the textquery, “photos of cat,” the social-networking system 20 may generate afirst structured query “Photos of Catey” and a second structured query“Photos of Catherine,” where “Photos” in the structured query is areference corresponding to a particular social-graph element, and where“Catey” and “Catherine” are references to two different user nodes 302.When executing either of these structured queries, the social-networkingsystem 20 may identify one or more concept nodes 304 corresponding tophotos that are connected to the identified user nodes 302 by edges 306.Although this disclosure describes generating particular structuredqueries in a particular manner, this disclosure contemplates generatingany suitable structured queries in any suitable manner.

In particular embodiments, social-networking system 20 may generate oneor more structured queries that each comprise references to one or moreof the identified concept nodes 304 and one or more of the identifiededges 306. This type of structured search query may allow thesocial-networking system 20 to more efficiently search for resources andcontent related to the online social network (such as, for example,profile pages) by search for content connected to or otherwise relatedto the identified concept nodes 304 and the identified edges 306. As anexample and not by way of limitation, in response to the text query,“friends who like facebook,” the social-networking system 20 maygenerate a structured query “Friends who like Facebook,” as illustratedin drop-down menu 600 in FIG. 6F, where “Friends,” like,” and “Facebook”in the structured query are references corresponding to particularsocial-graph elements as described previously (i.e., a “friend” edge306, a “like” edge 306, and a “Facebook concept node 304). In particularembodiments, the social-networking system 20 may generate a plurality ofstructured queries, where the structured queries may comprise referencesto different identified concept nodes 304 or different identified edges306. As an example and not by way of limitation, continuing with theprevious example, in addition to the structured query “Friends who likeFacebook,” the social-networking system 20 may also generate astructured query “Friends who like Facebook Culinary Team,” also asillustrated in drop-down menu 600 in FIG. 6F, where “Facebook CulinaryTeam” in the structured query is a reference corresponding to yetanother social-graph element. Although this disclosure describesgenerating particular structured queries in a particular manner, thisdisclosure contemplates generating any suitable structured queries inany suitable manner.

In particular embodiments, social-networking system 20 may rank thegenerated structured queries. The structured queries may be ranked basedon a variety of factors. Structured queries that are given ahigher/better rank may be considered more relevant to the querying useror a better match to the unstructured text query received from thequerying user. Similarly, structured queries that are given ahigher/better rank may reference social-graph elements that are morerelevant to the querying user or have a higher probability of matchingthe n-grams from the unstructured text query received from the queryinguser. In particular embodiments, the social-networking system 20 mayrank each of the structured queries based on the degree of separationbetween the first user node 302 corresponding to the first user (i.e,the querying user) and at least one of the identified user nodes 302 orconcept nodes 304 referenced in the structured query. Structured queriesincluding referenced nodes that are closer in the social graph 300 tothe querying user (i.e., fewer degrees of separation) may be rankedhigher than structured queries containing nodes further away from thequerying user. In particular embodiments, the social-networking system20 may rank each of the structured queries based on a search historyassociated with the first user. Structured queries referencingsocial-graph elements that have been searched for or accessed morerecently or more frequently by the querying user may be ranked higherthan structured queries referencing social-graph elements that have notbeen accessed recently, frequently, or at all by the querying user. Asan example and not by way of limitation, if the querying user haspreviously searched for the “Facebook Culinary Team” and visited aconcept-profile page corresponding to the concept node 304 for the“Facebook Culinary Team,” then structured queries referencing thissocial-graph element may be ranked relatively high compared to otherstructured queries, as illustrated in FIG. 6F. In particularembodiments, the structured queries may be ranked based on advertisingsponsorship. An advertiser (such as, for example, the user oradministrator of a particular profile page corresponding to a particularnode) may sponsor a particular node such that structured queriesreferencing the node are ranked higher than structured queries that donot reference the particular node. As an example and not by way oflimitation, the n-gram “smart phone” may correspond to a concept node304 for “IPHONE” (which is a type of smart phone) and may alsocorrespond to a concept node for “ANDROID” (which is another type ofsmart phone). If one of these concept nodes 304 is sponsored by anadvertiser, then the social-networking system 20 may rank the structuredqueries referencing the sponsored node higher than the structuredqueries referencing the non-sponsored (or less sponsored) node. Inparticular embodiments, the social-networking system 20 may rank each ofthe structured queries based on the social relevance of the social-graphelements referenced in the structured queries. As an example and not byway of limitation, the social relevance of a particular node may bebased on the number of edges 306 connected to the particular nodes, suchthat a structured query referencing a node connected by more edges 306may be ranked higher than a structure query referencing a node connectedby fewer edges 306. As another example and not by way of limitation, thesocial relevance of a particular edge 306 or edge-type may be based onthe frequency of that edge-type being connected to particular nodes. Inparticular embodiments, the social-networking system 20 may rank each ofthe structured queries based on the textual relevance of the structuredquery with respect to the received text query. The textual relevance ofa particular structured query may be based on how the terms and numberof terms in the particular structured query match to the text queryreceived from the querying user. As an example and not by way oflimitation, a structured query that with fewer inserted terms comparedto the received text query may be ranked higher than a structured querywith more inserted terms. In particular embodiments, thesocial-networking system 20 may rank each of the structured queriesbased on the importance or popularity of the structured query. As anexample and not by way of limitation, a first structured querycontaining “Friends of User A” may be ranked higher than a secondstructured query containing “Pictures of User A” because structuredqueries referencing “friend” edge-types may be more important or morepopular on the online social network than structured queries referencing“picture” edge-types. As another example and not by way of limitation, afirst structured query containing “Stanford students” may be rankedhigher than a second structured query containing “Stanford employees”because structured queries referencing “student” edge-types may be moreimportant or more popular on the online social network than structuredqueries referencing “employee” edge-types. In particular embodiments,the social-networking system 20 may rank each of the structured queriesbased on the tenses of the terms used in the structured query.Structured queries using terms with a particular tense may be rankedmore highly then structured queries using terms with a different tense.Although this disclosure describes ranking structured queries in aparticular manner, this disclosure contemplates ranking structuredqueries in any suitable manner.

In particular embodiments, social-networking system 20 may transmit oneor more of the structured queries to the first user (i.e., the queryinguser). As an example and not by way of limitation, after the structuredqueries are generated, the social-networking system 20 may transmit oneor more of the structured queries as a response (which may utilize AJAXor other suitable techniques) to the user's client device 30 that mayinclude, for example, the names (name strings) of the referencedsocial-graph elements, other query limitations (e.g., Boolean operators,etc.), as well as, potentially, other metadata associated with thereferenced social-graph elements. The web browser 202 on the queryinguser's client device 30 may display the transmitted structured queriesin a drop-down menu 600, as illustrated in FIGS. 6A-6R. In particularembodiments, the transmitted queries may be presented to the queryinguser in a ranked order, such as, for example, based on a rank previouslydetermined as described above. Structured queries with better rankingsmay be presented in a more prominent position. Furthermore, inparticular embodiments, only structured queries above a threshold rankmay be transmitted or displayed to the querying user. As an example andnot by way of limitation, as illustrated in FIGS. 6A-6R, the structuredqueries may be presented to the querying user in a drop-down menu 600where higher ranked structured queries may be presented at the top ofthe menu, with lower ranked structured queries presented in descendingorder down the menu. In the examples illustrated in FIGS. 6A-6R, onlythe seven highest ranked queries are transmitted and displayed to theuser. In particular embodiments, one or more references in a structuredquery may be highlighted in order to indicate its correspondence to aparticular social-graph element. As an example and not by way oflimitation, as illustrated in FIGS. 6F-6I, the reference to “Facebook”may be highlighted in the structured queries to indicate that itcorresponds to a particular concept node 304. Similarly, the referencesto “Friends” and “like” in the structured queries presented in drop-downmenu 600 could also be highlighted to indicate that they correspond toparticular edges 306. Although this disclosure describes transmittingparticular structured queries in a particular manner, this disclosurecontemplates transmitting any suitable structured queries in anysuitable manner.

In particular embodiments, social-networking system 20 may receive fromthe first user (i.e., the querying user) a selection of one of thestructured queries. As an example and not by way of limitation, the webbrowser 202 on the querying user's client device 30 may display thetransmitted structured queries in a drop-down menu 600, as illustratedin FIGS. 6A-6R, which the user may then click on or otherwise select(e.g., by simply keying “enter” on his keyboard) to indicate theparticular structured query the user wants the social-networking system20 to execute. Upon selecting the particular structured query, theuser's client device 30 may call or otherwise instruct to thesocial-networking system 20 to execute the selected structured query.Although this disclosure describes receiving selections of particularstructured queries in a particular manner, this disclosure contemplatesreceiving selections of any suitable structured queries in any suitablemanner.

In particular embodiments, social-networking system 20 may generatesearch results corresponding to the selection of one of the structuredqueries. Generating search results based on structured queries isdescribed more below.

FIG. 8 illustrates an example method 800 for generating personalizedstructured search queries. The method may begin at step 810, where thesocial-networking system 20 may access a social graph 300 comprising aplurality of user nodes 302 and a plurality of edges 306 connecting theuser nodes 302. Each edge 306 between two user nodes 302 represents asingle degree of separation between them. The plurality of user nodes302 may include a first user node 302 corresponding to a first userassociated with an online social network. The plurality of user nodes302 may also include one or more second user nodes 302 that eachcorrespond to a second user associated with the online social network.Each of the second user nodes 302 may be within a threshold degree ofseparation from the first user node 302. At step 820, thesocial-networking system 20 may receive from the first user a text querycomprising one or more character strings. At step 830, thesocial-networking system 20 may identify one or more of the second usernodes 302 that correspond to one or more of the character strings. Atstep 840, the social-networking system 20 may identify one or more ofthe edges 306 that correspond to one or more of the character strings.Each of the identified edges 306 may be connected to one of the seconduser nodes 302. At step 850, the social-networking system 20 maygenerate one or more recommended queries. Each structure query mayinclude references to one or more of the identified second user nodes302 and one or more of the identified edges 306. Particular embodimentsmay repeat one or more steps of the method of FIG. 8, where appropriate.Although this disclosure describes and illustrates particular steps ofthe method of FIG. 8 as occurring in a particular order, this disclosurecontemplates any suitable steps of the method of FIG. 8 occurring in anysuitable order. Moreover, although this disclosure describes andillustrates particular components, devices, or systems carrying outparticular steps of the method of FIG. 8, this disclosure contemplatesany suitable combination of any suitable components, devices, or systemscarrying out any suitable steps of the method of FIG. 8.

FIG. 9 illustrates an example method 900 for generating structuredqueries based on social-graph information. The method may begin at step910, where the social-networking system 20 may, where thesocial-networking system 20 may access a social graph 300 comprising aplurality of nodes and a plurality of edges 306 connecting the nodes.The nodes may comprise a first user node 302, a plurality of secondnodes (e.g., user nodes 302 and concept nodes 304). At step 920, thesocial-networking system 20 may receive from the first user asubstantially unstructured text query comprising one or more n-grams. Atstep 930, the social-networking system 20 may identify one or more ofthe second nodes that correspond to one or more of the n-grams. At step940, the social-networking system 20 may identify one or more of theedges 306 that correspond to one or more of the n-grams. Each of theidentified edges may be connected to at least one of the identifiedsecond nodes. At step 950, the social-networking system 20 may generateone or more structured queries. Each structured query may includereferences to one or more of the identified second nodes and one or moreof the identified edges 306. Particular embodiments may repeat one ormore steps of the method of FIG. 9, where appropriate. Although thisdisclosure describes and illustrates particular steps of the method ofFIG. 9 as occurring in a particular order, this disclosure contemplatesany suitable steps of the method of FIG. 9 occurring in any suitableorder. Moreover, although this disclosure describes and illustratesparticular components, devices, or systems carrying out particular stepsof the method of FIG. 9, this disclosure contemplates any suitablecombination of any suitable components, devices, or systems carrying outany suitable steps of the method of FIG. 9.

Filtering Search Results Based on Privacy Setting

In particular embodiments, when generating search results in response toa structured search query, the social-networking system 20 may filterthe search results based on privacy settings associated with particularusers of the online social network. As an example and not by way oflimitation, after a structured query is selected by a querying user andreceived by the social-networking system 20, a search engine mayidentify target content (e.g., nodes and/or their corresponding profilepages) that satisfies or matches the query conditions. The targetcontent (and more specifically, the target nodes corresponding to thetarget content) may be associated with privacy settings that specifywhich other users of the online social network may view or access thecontent. For example, particular social-graph elements may not bevisible to the querying user, and thus a structure search queryreferencing that social-graph element (or its related elements) shouldnot generate search results relying on that element. Consequently,particular target content may not be displayed in the search resultsbecause of the privacy settings associated with that content. FIG. 10illustrates an example social graph 300. The social graph 300illustrated in FIG. 10 may be referenced in some of the examples belowto illustrate how privacy settings are used to filter search results.Although this disclosure describes filtering search results based onprivacy settings in a particular manner, this disclosure contemplatesfiltering search results based on privacy settings in any suitablemanner.

In particular embodiments, social-networking system 20 may access theprivacy settings associated with each target node and each selectednode. The privacy settings for each node may define the visibility ofthe node or the visibility of edges connecting to the node to users ofthe social-networking system 20. In this way, the ability of users ofthe online social network (or even users outside the network) may berestricted by limiting their ability to view or access profile-pages (orother related content) associated with particular nodes. As an exampleand not by way of limitation, a first user's privacy settings specifythat his profile-page can only be viewed or accessed by “friends offriends” (i.e., second-degree friends), thereby preventing users who arethree or more degrees of separation from the first user from viewing oraccessing the first user's profile page. As another example and not byway of limitation, referencing FIG. 10, the privacy settings for user“9” may specify that his educational information is not visible to otherusers, and therefore the “attended” edge 306 connecting the user node302 for user “9” to the concept node 304 corresponding to the school“Stanford” may not be visible to other users. Thus, the privacy settingsfor user “9” would prevent references to his user node 302 (orcorresponding user-profile page) from appearing in search results forusers that attended Stanford. Although this disclosure describesaccessing particular privacy settings in a particular manner, thisdisclosure contemplates accessing any suitable privacy settings in anysuitable manner.

In particular embodiments, social-networking system 20 may identify oneor more target nodes corresponding to the structured query. A targetnode may be a user node 302 or a concept node 304 that is connected byat least one edge to at least one of the nodes referenced in a selectedstructured query. As an example and not by way of limitation,referencing FIG. 10, the social-networking system 20 may receive thefollowing substantially unstructured text query from a user, “show meuser 5's friends,” which the social-networking system 20 may parse togenerate a structured query, “Friends of User 5,” where the reference to“Friends” corresponds to particular “friend” edges 306 and “User 5”corresponds to the user node 302 for user “5.” The social-networkingsystem 20 may then identify the user nodes 302 corresponding to user “4”and user “7” as target nodes corresponding to the structured querybecause both of those nodes are connected to the node for user “5” by“friend” edges 306. Although this disclosure describes identifyingparticular target nodes in a particular manner, this disclosurecontemplates identifying any suitable target nodes in any suitablemanner.

In particular embodiments, social-networking system 20 may generatesearch results comprising references to each target node that isconnected to the first/querying user node 302 in the social graph 300 bya series of nodes and edges 306 that have a visibility that is visibleto the first user. The nodes and edges in the path between the firstuser and the target node may comprise nodes and edges references in theselected structured query. As an example and not by way of limitation,continuing with the prior example referencing FIG. 10, the structuredquery “Friends of User 5” references the user node 302 for user “5” andthe “friends” edges 306 connected to that node. This structured querymay identify the target nodes for user “4” and user “7.” Assuming thequerying user can view the node for user “5,” then the privacy settingsof users “4,” “5,” and “7” may be accessed to determine whether theedges connecting these users are visible. For example, either users “4”or “5” may have privacy settings that make it so the “friend” edge 306connecting them is not visible to particular other users; if this edge306 is visible to the querying user, then the generated search resultscould include a reference to user “4.” Similarly, either users “5” or“7” may have privacy settings that make it so the “friend” edge 306connecting them is not visible; thus, if this edge 306 is visible to thequerying user, then the generated search results could include areference to user “7.” In particular embodiments, the user node 302 forthe querying user does not necessarily need to be connected by a visiblepath to the target node; however, there should be at least a pathbetween a node that is visible to the querying user (a source node) andthe target node. As an example and not by way of limitation, continuingwith the prior example, the querying user does not necessarily need tobe connected in a path to either user “4” or user “7”; so long as thequerying user can view a source node, which may be user “5” in thiscase, and so long as the querying user can view the path between user“5” and the target nodes, then the target nodes may appear in searchresults. The querying user may be able to view the source node, forexample, because that node is publicly accessible or within a thresholddegree of separation of the querying user. Although this disclosuredescribes generating search results in a particular manner, thisdisclosure contemplates generating search results in any suitablemanner.

In particular embodiments, social-networking system 20 may receive aselection of a structured query comprising a first condition and one ormore second conditions, where at least one of the second conditions isdependent on the first condition. The social networking system mayresolve such a query by identifying one or more nodes that satisfy thefirst condition and applying the nodes that satisfy the first conditionto each second condition that is dependent on the first condition. Asanother example and not by way of limitation, referencing FIG. 10, thesocial-networking system 20 may receive the following substantiallyunstructured text query from a user: “find me people who are friends ofuser 11 or friends of user 10 and friends of user 5 or attendedstanford.” The social-networking system 20 may parse this text query andgenerate the following structured search query: “Find Friends of User 11or friends of User 10 that are also friends of User 5 or attendedStanford,” where the references to “friends of” and “attended”correspond to particular edges 306, references to “User 5,” “User 10,”and “User 11” correspond to particular user nodes 302, and the referenceto “Stanford” corresponds to a particular concept node 304. Theequivalent symbolic expression (“s-expression”) for this query would be:(or (and friend:10 (apply friend: (or friend:5 attended>6))) friend:11),where the concept node 304 corresponding to “Stanford” is beingreferenced as “6.” The social-networking system 20 may identify theinner condition of (apply friend: (or friend:5 attended>6)) as a firstcondition that needs to be resolved before the dependent outer conditioncan be resolved. Referencing FIG. 10, the inner condition can beresolved by identifying users that are either friends of user “5” orusers that attended “Stanford.” The friends of user “5” are users “4”and “7,” both of whom are connected by “friend” edges 306 to the nodefor user “5.” The users that attended “Stanford” are users “4,” “7,” and“9.” Therefore, combining these results, the inner condition hasidentified the user nodes 302 for users “4,” “7,” and “9.” These threeresults may now be applied using the apply-operator to the outercondition, which may now be re-expressed as the s-expression: (or (andfriend:10 (or friend:4 friend:7 friend:9) friend:11). This re-expressedquery may be resolved by identifying users that are either friends ofuser “11” or friends of both user “10” and one of users “4,” “7,” or“9.” The only friend of user “11” is user “10.” The friends of user “10”include users “3” and “8,” while the friends of users “4,” “7,” and “9”include users “3,” “5,” and “8”; thus users “3” and “8” are friends inboth sets and satisfy this condition. Thus, the outer condition wouldidentify user nodes 302 for users “3,” “8,” and 10” as target nodescorresponding to the structured query. Although this disclosuredescribes resolving search queries in a particular manner, thisdisclosure contemplates resolving search queries in any suitable manner.

FIGS. 11A-11C illustrate example sub-graphs for resolving privacysettings. In particular embodiments, the social-networking system 20 maygenerate a sub-graph for each target node. The sub-graph may comprisethe first-user node (i.e., a user node 302 of the querying user), thetarget node, and each selected node and each selected edge connectingthe first-user node and the target node in the social graph. As anexample and not by way of limitation, continuing with the examples fromthe prior paragraph, sub-graphs may be constructed for the target nodescorresponding to users “3,” “8,” and “10,” which are illustrated inFIGS. 11A, 11B, and 11C, respectively. These graphs illustrate each edge306 in path between the querying user and the target node. For example,the edge 306 connecting user's “10” and “3” is illustrated in FIG. 11Aas “friend:10→3”. The social-networking system 20 may then identify, foreach sub-graph, each terminal path in the sub-graph connecting thefirst-user node to the target node. A terminal path includes the seriesof selected nodes and selected edges connecting the first-user node tothe target node. As an example and not by way of limitation, theterminal path connecting the querying user to the target node for user“10” consists of the edge 306 connecting the querying user to the nodefor user “11,” the user node 302 for user “11,” and the edge 306connecting user “11” to user “10,” as illustrated in FIG. 11C. Ofcourse, multiple terminal paths may exist between the querying user andthe target node, as illustrated in FIGS. 11A and 11B, and each of theseterminal paths may be identified. The social-networking system 20 maythen determine, for each terminal path in the sub-graph, whether eachselected edge in the terminal path has a visibility that is visible tothe first user. In other words, the social-networking system 20 mayattempt to find whether the sub-graph has any privacy-allowed pathsbetween the querying user and the target node. As an example and not byway of limitation, to determine whether the terminal path in FIG. 11C isvisible to the querying user, the social-networking system 20 mayevaluate the following s-expression: (edge friend:11 10). As anotherexample and not by way of limitation, to determine whether the terminalpath in FIG. 11A is visible to the querying user, the social-networkingsystem 20 may evaluate the following s-expression: (and (edge friend: 103) (edge friend:4 3) (or (edge attended>6 4) (edge friend:5 4))). Wheremultiple terminal paths exist in a particular sub-graph, thesocial-networking system 20 may evaluate some or all of the terminalpaths to determine whether the edges 306 in each path are visible. Thesocial-networking system 20 may then identify each sub-graph having atleast one terminal path wherein each selected edge in the path has avisibility that is visible to the first user. Therefore, where asub-graph includes multiple terminal paths between the querying user andthe target node, the sub-graph may still be identified as having aprivacy-allowed path so long as at least one terminal path in thesub-graph is visible to the user. The generated search results wouldthen include references to each target nodes that corresponds to anidentified sub-graph having at least one visible terminal paths. As anexample and not by way of limitation, referencing FIG. 11A, there aretwo possible terminal paths between the querying user and the targetnode for user “3.” So long as at least one of the two possible terminalpaths is visible to the querying user, then the target node for user “3”will be included in the search results for the query. In particularembodiments, the user node 302 for the querying user does notnecessarily need to be connected by a visible path to the target node;however, there should be at least a path between a node that is visibleto the querying user (a source node) and the target node. As an exampleand not by way of limitation, continuing with the prior example, thequerying user does not necessarily need to be connected in a path toeither users “3,” “8,” or “10”; so long as the querying user can view asource node and a path between the source node and the target node, thenthe target node may appear in search results. Although this disclosuredescribes and FIGS. 11A-11C illustrate resolving privacy settings in aparticular manner, this disclosure contemplates resolving privacysettings in any suitable manner.

In particular embodiments, social-networking system 20 may generatesearch results corresponding to the selection of one of the structuredqueries. The search results may be presented in a structured document(e.g., a search results webpage) comprising one or more links or otherreferences to the content (e.g., profile pages) corresponding thestructured query. The references in the search results may be used tonavigate to the corresponding content. In particular embodiments, thesearch results may comprise references to one or more of the identifieduser nodes 302, one or more of the identified concept nodes 304, or anycombination thereof. As an example and not by way of limitation,referencing FIG. 3, user “B” may select the structured query of “Friendswho worked at Acme,” where “Friends” is a reference to the “friends”edges 306 connecting user “B” to other users, “worked at” is a referenceto the “worked at” edges 306 connected to the user nodes 302 of friendsof user “B,” and “Acme” is a reference to the concept node 304 for thecompany “Acme.” The social-networking system 20 may then identify theuser node 302 corresponding to user “C” in the social graph 300 ascorresponding to the structured query, since the user node 302 for user“C” connected by a “friend” edge 306 to user “B” and connected by a“worked at” edge to the identified concept node 304 corresponding to“ACME.” The social-networking system 20 may then generate search resultsthat lists or otherwise references user “C,” along with any othersocial-graph elements that correspond to the selected search query. Inparticular embodiments, the search results may comprise references touser nodes 302 or concept nodes 304 that are connected by one or moreedges 306 to the identified user nodes 302 or the identified conceptnodes 304. Although this disclosure describes generating particularsearch results corresponding to structured queries in a particularmanner, this disclosure contemplates generating any suitable searchresults corresponding to structured queries in any suitable manner.

In particular embodiments, social-networking system 20 may only generatesearch results comprising references to target nodes (i.e., user nodes302 or concept node 304) within a threshold degree of separation of theuser node 302 corresponding to the first user (i.e., the querying user).The threshold degree of separation may be, for example, one, two, three,or all. Although this disclosure describes generating search results ina particular manner, this disclosure contemplates generating searchresults in any suitable manner.

FIG. 12 illustrates an example method 1200 for filtering the searchresults for a structured search query based on privacy settings. Themethod may begin at step 1210, where the social-networking system 20 mayaccess a social graph 300 comprising a plurality of nodes and aplurality of edges 306 connecting the nodes. The nodes may comprise afirst user node 302 and a plurality of second nodes (one or more usernodes 302, concepts nodes 304, or any combination thereof). Each secondnode may be associated with a privacy setting defining a visibility ofeach edge 306 connected to the second node. At step 1220, thesocial-networking system 20 may receive from the first user a structuredquery comprising references to one or more selected nodes from the oneor more second nodes and one or more selected edges 306 from theplurality of edges 306. At step 1230, the social-networking system 20may identify one or more target nodes corresponding to the structuredquery. Each target node may be a second node from the plurality ofsecond nodes that is connected to at least one of the selected nodes byat least one of the selected edges 306. At step 1240, thesocial-networking system 20 may generate search results comprisingreferences to each target node that is connected to the first user node302 in the social graph 300 by a series of selected nodes and selectededges 306 that have a visibility that is visible to the first user.Furthermore, the generated search results may only include target nodesthat are within a threshold degree of separation from the first usernode 302. Particular embodiments may repeat one or more steps of themethod of FIG. 12, where appropriate. Although this disclosure describesand illustrates particular steps of the method of FIG. 12 as occurringin a particular order, this disclosure contemplates any suitable stepsof the method of FIG. 12 occurring in any suitable order. Moreover,although this disclosure describes and illustrates particularcomponents, devices, or systems carrying out particular steps of themethod of FIG. 12, this disclosure contemplates any suitable combinationof any suitable components, devices, or systems carrying out anysuitable steps of the method of FIG. 12.

Systems and Methods

FIG. 13 illustrates an example computer system 1300. In particularembodiments, one or more computer systems 1300 perform one or more stepsof one or more methods described or illustrated herein. In particularembodiments, one or more computer systems 1300 provide functionalitydescribed or illustrated herein. In particular embodiments, softwarerunning on one or more computer systems 1300 performs one or more stepsof one or more methods described or illustrated herein or providesfunctionality described or illustrated herein. Particular embodimentsinclude one or more portions of one or more computer systems 1300.

This disclosure contemplates any suitable number of computer systems1300. This disclosure contemplates computer system 1300 taking anysuitable physical form. As example and not by way of limitation,computer system 1300 may be an embedded computer system, asystem-on-chip (SOC), a single-board computer system (SBC) (such as, forexample, a computer-on-module (COM) or system-on-module (SOM)), adesktop computer system, a laptop or notebook computer system, aninteractive kiosk, a mainframe, a mesh of computer systems, a mobiletelephone, a personal digital assistant (PDA), a server, a tabletcomputer system, or a combination of two or more of these. Whereappropriate, computer system 1300 may include one or more computersystems 1300; be unitary or distributed; span multiple locations; spanmultiple machines; span multiple data centers; or reside in a cloud,which may include one or more cloud components in one or more networks.Where appropriate, one or more computer systems 1300 may perform withoutsubstantial spatial or temporal limitation one or more steps of one ormore methods described or illustrated herein. As an example and not byway of limitation, one or more computer systems 1300 may perform in realtime or in batch mode one or more steps of one or more methods describedor illustrated herein. One or more computer systems 1300 may perform atdifferent times or at different locations one or more steps of one ormore methods described or illustrated herein, where appropriate.

In particular embodiments, computer system 1300 includes a processor1302, memory 1304, storage 1306, an input/output (I/O) interface 1308, acommunication interface 1310, and a bus 1312. Although this disclosuredescribes and illustrates a particular computer system having aparticular number of particular components in a particular arrangement,this disclosure contemplates any suitable computer system having anysuitable number of any suitable components in any suitable arrangement.

In particular embodiments, processor 1302 includes hardware forexecuting instructions, such as those making up a computer program. Asan example and not by way of limitation, to execute instructions,processor 1302 may retrieve (or fetch) the instructions from an internalregister, an internal cache, memory 1304, or storage 1306; decode andexecute them; and then write one or more results to an internalregister, an internal cache, memory 1304, or storage 1306. In particularembodiments, processor 1302 may include one or more internal caches fordata, instructions, or addresses. This disclosure contemplates processor1302 including any suitable number of any suitable internal caches,where appropriate. As an example and not by way of limitation, processor1302 may include one or more instruction caches, one or more datacaches, and one or more translation lookaside buffers (TLBs).Instructions in the instruction caches may be copies of instructions inmemory 1304 or storage 1306, and the instruction caches may speed upretrieval of those instructions by processor 1302. Data in the datacaches may be copies of data in memory 1304 or storage 1306 forinstructions executing at processor 1302 to operate on; the results ofprevious instructions executed at processor 1302 for access bysubsequent instructions executing at processor 1302 or for writing tomemory 1304 or storage 1306; or other suitable data. The data caches mayspeed up read or write operations by processor 1302. The TLBs may speedup virtual-address translation for processor 1302. In particularembodiments, processor 1302 may include one or more internal registersfor data, instructions, or addresses. This disclosure contemplatesprocessor 1302 including any suitable number of any suitable internalregisters, where appropriate. Where appropriate, processor 1302 mayinclude one or more arithmetic logic units (ALUs); be a multi-coreprocessor; or include one or more processors 1302. Although thisdisclosure describes and illustrates a particular processor, thisdisclosure contemplates any suitable processor.

In particular embodiments, memory 1304 includes main memory for storinginstructions for processor 1302 to execute or data for processor 1302 tooperate on. As an example and not by way of limitation, computer system1300 may load instructions from storage 1306 or another source (such as,for example, another computer system 1300) to memory 1304. Processor1302 may then load the instructions from memory 1304 to an internalregister or internal cache. To execute the instructions, processor 1302may retrieve the instructions from the internal register or internalcache and decode them. During or after execution of the instructions,processor 1302 may write one or more results (which may be intermediateor final results) to the internal register or internal cache. Processor1302 may then write one or more of those results to memory 1304. Inparticular embodiments, processor 1302 executes only instructions in oneor more internal registers or internal caches or in memory 1304 (asopposed to storage 1306 or elsewhere) and operates only on data in oneor more internal registers or internal caches or in memory 1304 (asopposed to storage 1306 or elsewhere). One or more memory buses (whichmay each include an address bus and a data bus) may couple processor1302 to memory 1304. Bus 1312 may include one or more memory buses, asdescribed below. In particular embodiments, one or more memorymanagement units (MMUs) reside between processor 1302 and memory 1304and facilitate accesses to memory 1304 requested by processor 1302. Inparticular embodiments, memory 1304 includes random access memory (RAM).This RAM may be volatile memory, where appropriate Where appropriate,this RAM may be dynamic RAM (DRAM) or static RAM (SRAM). Moreover, whereappropriate, this RAM may be single-ported or multi-ported RAM. Thisdisclosure contemplates any suitable RAM. Memory 1304 may include one ormore memories 1304, where appropriate. Although this disclosuredescribes and illustrates particular memory, this disclosurecontemplates any suitable memory.

In particular embodiments, storage 1306 includes mass storage for dataor instructions. As an example and not by way of limitation, storage1306 may include a hard disk drive (HDD), a floppy disk drive, flashmemory, an optical disc, a magneto-optical disc, magnetic tape, or aUniversal Serial Bus (USB) drive or a combination of two or more ofthese. Storage 1306 may include removable or non-removable (or fixed)media, where appropriate. Storage 1306 may be internal or external tocomputer system 1300, where appropriate. In particular embodiments,storage 1306 is non-volatile, solid-state memory. In particularembodiments, storage 1306 includes read-only memory (ROM). Whereappropriate, this ROM may be mask-programmed ROM, programmable ROM(PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM),electrically alterable ROM (EAROM), or flash memory or a combination oftwo or more of these. This disclosure contemplates mass storage 1306taking any suitable physical form. Storage 1306 may include one or morestorage control units facilitating communication between processor 1302and storage 1306, where appropriate. Where appropriate, storage 1306 mayinclude one or more storages 1306. Although this disclosure describesand illustrates particular storage, this disclosure contemplates anysuitable storage.

In particular embodiments, I/O interface 1308 includes hardware,software, or both providing one or more interfaces for communicationbetween computer system 1300 and one or more I/O devices. Computersystem 1300 may include one or more of these I/O devices, whereappropriate. One or more of these I/O devices may enable communicationbetween a person and computer system 1300. As an example and not by wayof limitation, an I/O device may include a keyboard, keypad, microphone,monitor, mouse, printer, scanner, speaker, still camera, stylus, tablet,touch screen, trackball, video camera, another suitable I/O device or acombination of two or more of these. An I/O device may include one ormore sensors. This disclosure contemplates any suitable I/O devices andany suitable I/O interfaces 1308 for them. Where appropriate, I/Ointerface 1308 may include one or more device or software driversenabling processor 1302 to drive one or more of these I/O devices. I/Ointerface 1308 may include one or more I/O interfaces 1308, whereappropriate. Although this disclosure describes and illustrates aparticular I/O interface, this disclosure contemplates any suitable I/Ointerface.

In particular embodiments, communication interface 1310 includeshardware, software, or both providing one or more interfaces forcommunication (such as, for example, packet-based communication) betweencomputer system 1300 and one or more other computer systems 1300 or oneor more networks. As an example and not by way of limitation,communication interface 1310 may include a network interface controller(NIC) or network adapter for communicating with an Ethernet or otherwire-based network or a wireless NIC (WNIC) or wireless adapter forcommunicating with a wireless network, such as a WI-FI network. Thisdisclosure contemplates any suitable network and any suitablecommunication interface 1310 for it. As an example and not by way oflimitation, computer system 1300 may communicate with an ad hoc network,a personal area network (PAN), a local area network (LAN), a wide areanetwork (WAN), a metropolitan area network (MAN), or one or moreportions of the Internet or a combination of two or more of these. Oneor more portions of one or more of these networks may be wired orwireless. As an example and not by way of limitation, computer system1300 may communicate with a wireless PAN (WPAN) (such as, for example, aBLUETOOTH WPAN), a WI-FI network, a WI-MAX network, a cellular telephonenetwork (such as, for example, a Global System for Mobile Communications(GSM) network), or other suitable wireless network or a combination oftwo or more of these. Computer system 1300 may include any suitablecommunication interface 1310 for any of these networks, whereappropriate. Communication interface 1310 may include one or morecommunication interfaces 1310, where appropriate. Although thisdisclosure describes and illustrates a particular communicationinterface, this disclosure contemplates any suitable communicationinterface.

In particular embodiments, bus 1312 includes hardware, software, or bothcoupling components of computer system 1300 to each other. As an exampleand not by way of limitation, bus 1312 may include an AcceleratedGraphics Port (AGP) or other graphics bus, an Enhanced Industry StandardArchitecture (EISA) bus, a front-side bus (FSB), a HYPERTRANSPORT (HT)interconnect, an Industry Standard Architecture (ISA) bus, an INFINIBANDinterconnect, a low-pin-count (LPC) bus, a memory bus, a Micro ChannelArchitecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, aPCI-Express (PCIe) bus, a serial advanced technology attachment (SATA)bus, a Video Electronics Standards Association local (VLB) bus, oranother suitable bus or a combination of two or more of these. Bus 1312may include one or more buses 1312, where appropriate. Although thisdisclosure describes and illustrates a particular bus, this disclosurecontemplates any suitable bus or interconnect.

Herein, reference to a computer-readable non-transitory storage mediummay include a semiconductor-based or other integrated circuit (IC) (suchas, for example, a field-programmable gate array (FPGA) or anapplication-specific IC (ASIC)), a hard disk drive (HDD), a hybrid harddrive (HHD), an optical disc, an optical disc drive (ODD), amagneto-optical disc, a magneto-optical drive, a floppy disk, a floppydisk drive (FDD), magnetic tape, a holographic storage medium, asolid-state drive (SSD), a RAM-drive, a SECURE DIGITAL card, a SECUREDIGITAL drive, another suitable computer-readable non-transitory storagemedium, or a suitable combination of these, where appropriate. Acomputer-readable non-transitory storage medium may be volatile,non-volatile, or a combination of volatile and non-volatile, whereappropriate.

This disclosure contemplates one or more computer-readable storage mediaimplementing any suitable storage. In particular embodiments, acomputer-readable storage medium implements one or more portions ofprocessor 1302 (such as, for example, one or more internal registers orcaches), one or more portions of memory 1304, one or more portions ofstorage 1306, or a combination of these, where appropriate. Inparticular embodiments, a computer-readable storage medium implementsRAM or ROM. In particular embodiments, a computer-readable storagemedium implements volatile or persistent memory. In particularembodiments, one or more computer-readable storage media embodysoftware. Herein, reference to software may encompass one or moreapplications, bytecode, one or more computer programs, one or moreexecutables, one or more instructions, logic, machine code, one or morescripts, or source code, and vice versa, where appropriate. Inparticular embodiments, software includes one or more applicationprogramming interfaces (APIs). This disclosure contemplates any suitablesoftware written or otherwise expressed in any suitable programminglanguage or combination of programming languages. In particularembodiments, software is expressed as source code or object code. Inparticular embodiments, software is expressed in a higher-levelprogramming language, such as, for example, C, Perl, or a suitableextension thereof. In particular embodiments, software is expressed in alower-level programming language, such as assembly language (or machinecode). In particular embodiments, software is expressed in JAVA. Inparticular embodiments, software is expressed in Hyper Text MarkupLanguage (HTML), Extensible Markup Language (XML), or other suitablemarkup language.

FIG. 14 illustrates an example network environment 1400. This disclosurecontemplates any suitable network environment 1400. As an example andnot by way of limitation, although this disclosure describes andillustrates a network environment 1400 that implements a client-servermodel, this disclosure contemplates one or more portions of a networkenvironment 1400 being peer-to-peer, where appropriate. Particularembodiments may operate in whole or in part in one or more networkenvironments 1400. In particular embodiments, one or more elements ofnetwork environment 1400 provide functionality described or illustratedherein. Particular embodiments include one or more portions of networkenvironment 1400. Network environment 1400 includes a network 1410coupling one or more servers 1420 and one or more clients 1430 to eachother. This disclosure contemplates any suitable network 1410. As anexample and not by way of limitation, one or more portions of network1410 may include an ad hoc network, an intranet, an extranet, a virtualprivate network (VPN), a local area network (LAN), a wireless LAN(WLAN), a wide area network (WAN), a wireless WAN (WWAN), a metropolitanarea network (MAN), a portion of the Internet, a portion of the PublicSwitched Telephone Network (PSTN), a cellular telephone network, or acombination of two or more of these. Network 1410 may include one ormore networks 1410.

Links 1450 couple servers 1420 and clients 1430 to network 1410 or toeach other. This disclosure contemplates any suitable links 1450. As anexample and not by way of limitation, one or more links 1450 eachinclude one or more wireline (such as, for example, Digital SubscriberLine (DSL) or Data Over Cable Service Interface Specification (DOCSIS)),wireless (such as, for example, Wi-Fi or Worldwide Interoperability forMicrowave Access (WiMAX)) or optical (such as, for example, SynchronousOptical Network (SONET) or Synchronous Digital Hierarchy (SDH)) links1450. In particular embodiments, one or more links 1450 each includes anintranet, an extranet, a VPN, a LAN, a WLAN, a WAN, a MAN, acommunications network, a satellite network, a portion of the Internet,or another link 1450 or a combination of two or more such links 1450.Links 1450 need not necessarily be the same throughout networkenvironment 1400. One or more first links 1450 may differ in one or morerespects from one or more second links 1450.

This disclosure contemplates any suitable servers 1420. As an exampleand not by way of limitation, one or more servers 1420 may each includeone or more advertising servers, applications servers, catalog servers,communications servers, database servers, exchange servers, fax servers,file servers, game servers, home servers, mail servers, message servers,news servers, name or DNS servers, print servers, proxy servers, soundservers, standalone servers, web servers, or web-feed servers. Inparticular embodiments, a server 1420 includes hardware, software, orboth for providing the functionality of server 1420. As an example andnot by way of limitation, a server 1420 that operates as a web servermay be capable of hosting websites containing web pages or elements ofweb pages and include appropriate hardware, software, or both for doingso. In particular embodiments, a web server may host HTML or othersuitable files or dynamically create or constitute files for web pageson request. In response to a Hyper Text Transfer Protocol (HTTP) orother request from a client 1430, the web server may communicate one ormore such files to client 1430. As another example, a server 1420 thatoperates as a mail server may be capable of providing e-mail services toone or more clients 1430. As another example, a server 1420 thatoperates as a database server may be capable of providing an interfacefor interacting with one or more data stores (such as, for example, datastores 1440 described below). Where appropriate, a server 1420 mayinclude one or more servers 1420; be unitary or distributed; spanmultiple locations; span multiple machines; span multiple datacenters;or reside in a cloud, which may include one or more cloud components inone or more networks.

In particular embodiments, one or more links 1450 may couple a server1420 to one or more data stores 1440. A data store 1440 may store anysuitable information, and the contents of a data store 1440 may beorganized in any suitable manner. As an example and not by way orlimitation, the contents of a data store 1440 may be stored as adimensional, flat, hierarchical, network, object-oriented, relational,XML, or other suitable database or a combination or two or more ofthese. A data store 1440 (or a server 1420 coupled to it) may include adatabase-management system or other hardware or software for managingthe contents of data store 1440. The database-management system mayperform read and write operations, delete or erase data, perform datadeduplication, query or search the contents of data store 1440, orprovide other access to data store 1440.

In particular embodiments, one or more servers 1420 may each include oneor more search engines 1422. A search engine 1422 may include hardware,software, or both for providing the functionality of search engine 1422.As an example and not by way of limitation, a search engine 1422 mayimplement one or more search algorithms to identify network resources inresponse to search queries received at search engine 1422, one or moreranking algorithms to rank identified network resources, or one or moresummarization algorithms to summarize identified network resources. Inparticular embodiments, a ranking algorithm implemented by a searchengine 1422 may use a machine-learned ranking formula, which the rankingalgorithm may obtain automatically from a set of training dataconstructed from pairs of search queries and selected Uniform ResourceLocators (URLs), where appropriate.

In particular embodiments, one or more servers 1420 may each include oneor more data monitors/collectors 1424. A data monitor/collection 1424may include hardware, software, or both for providing the functionalityof data collector/collector 1424. As an example and not by way oflimitation, a data monitor/collector 1424 at a server 1420 may monitorand collect network-traffic data at server 1420 and store thenetwork-traffic data in one or more data stores 1440. In particularembodiments, server 1420 or another device may extract pairs of searchqueries and selected URLs from the network-traffic data, whereappropriate.

This disclosure contemplates any suitable clients 1430. A client 1430may enable a user at client 1430 to access or otherwise communicate withnetwork 1410, servers 1420, or other clients 1430. As an example and notby way of limitation, a client 1430 may have a web browser, such asMICROSOFT INTERNET EXPLORER or MOZILLA FIREFOX, and may have one or moreadd-ons, plug-ins, or other extensions, such as GOOGLE TOOLBAR or YAHOOTOOLBAR. A client 1430 may be an electronic device including hardware,software, or both for providing the functionality of client 1430. As anexample and not by way of limitation, a client 1430 may, whereappropriate, be an embedded computer system, an SOC, an SBC (such as,for example, a COM or SOM), a desktop computer system, a laptop ornotebook computer system, an interactive kiosk, a mainframe, a mesh ofcomputer systems, a mobile telephone, a PDA, a netbook computer system,a server, a tablet computer system, or a combination of two or more ofthese. Where appropriate, a client 1430 may include one or more clients1430; be unitary or distributed; span multiple locations; span multiplemachines; span multiple datacenters; or reside in a cloud, which mayinclude one or more cloud components in one or more networks.

Miscellaneous

Herein, “or” is inclusive and not exclusive, unless expressly indicatedotherwise or indicated otherwise by context. Therefore, herein, “A or B”means “A, B, or both,” unless expressly indicated otherwise or indicatedotherwise by context. Moreover, “and” is both joint and several, unlessexpressly indicated otherwise or indicated otherwise by context.Therefore, herein, “A and B” means “A and B, jointly or severally,”unless expressly indicated otherwise or indicated otherwise by context.Furthermore, “a”, “an,” or “the” is intended to mean “one or more,”unless expressly indicated otherwise or indicated otherwise by context.Therefore, herein, “an A” or “the A” means “one or more A,” unlessexpressly indicated otherwise or indicated otherwise by context.

This disclosure encompasses all changes, substitutions, variations,alterations, and modifications to the example embodiments herein that aperson having ordinary skill in the art would comprehend. Moreover,although this disclosure describes and illustrates respectiveembodiments herein as including particular components, elements,functions, operations, or steps, any of these embodiments may includeany combination or permutation of any of the components, elements,functions, operations, or steps described or illustrated anywhere hereinthat a person having ordinary skill in the art would comprehend.Furthermore, reference in the appended claims to an apparatus or systemor a component of an apparatus or system being adapted to, arranged to,capable of, configured to, enabled to, operable to, or operative toperform a particular function encompasses that apparatus, system,component, whether or not it or that particular function is activated,turned on, or unlocked, as long as that apparatus, system, or componentis so adapted, arranged, capable, configured, enabled, operable, oroperative.

1. A method comprising, by one or more computing devices: accessing asocial graph comprising a plurality of nodes and a plurality of edgesconnecting the nodes, each of the edges between two of the nodesrepresenting a single degree of separation between them, the nodescomprising: a first node corresponding to a first user associated withan online social network; and a plurality of second nodes that eachcorrespond to a concept or a second user associated with the onlinesocial network; receiving from the first user an unstructured text querycomprising one or more n-grams; identifying one or more of the secondnodes, each of the identified second nodes corresponding to one or moreof the n-grams; identifying one or more of the edges, each of theidentified edges being connected to at least one of the identifiedsecond nodes, each of the identified edges corresponding to one or moreof the n-grams; and generating one or more structured queries that eachcomprise references to one or more of the identified second nodes andone or more of the identified edges.
 2. The method of claim 1, furthercomprising receiving from the first user a selection of one of thestructured queries.
 3. The method of claim 2, further comprisinggenerating search results corresponding to the selection of one of thestructured queries, the search results comprising references to one ormore of the second nodes that are connected to at least one of theidentified second nodes by at least one of the identified edges.
 4. Themethod of claim 3, wherein each of the second nodes of the searchresults is within a threshold degree of separation from the first node.5. The method of claim 2, further comprising generating search resultscorresponding to the selection of one of the structured queries, thesearch results comprising references to one or more of the identifiedsecond nodes.
 6. The method of claim 1, further comprising ranking eachof the structured queries based on the degree of separation between thefirst node and at least one of the identified second nodes referenced inthe structured query.
 7. The method of claim 1, further comprisingranking each of the structured queries based on a search historyassociated with the first user.
 8. The method of claim 1, furthercomprising ranking each of the structured queries based on a socialrelevance of the identified second nodes or the identified edgesreferenced in the structured query.
 9. The method of claim 1, furthercomprising ranking each of the structured queries based on a textualrelevance of the structured query.
 10. The method of claim 1, whereineach of the identified second nodes is within a threshold degree ofseparation from the first node.
 11. The method of claim 10, wherein thethreshold degree of separation is one, two, three, or all.
 12. Themethod of claim 1, wherein identifying one or more of the second nodescomprises, for each n-gram: determining a probability for each secondnode that the second node corresponds to the n-gram; and identifyingeach second node with a probability greater than a thresholdprobability.
 13. The method of claim 1, wherein each n-gram comprisesone or more characters of text entered by the first user.
 14. The methodof claim 1, wherein each n-gram comprises a contiguous sequence of nitems from the text query.
 15. The method of claim 1, wherein, for eachstructured query, one or more of the references is highlighted toindicate the reference corresponds to an identified second node or anidentified edge.
 16. A system comprising: one or more processors; and amemory coupled to the processors comprising instructions executable bythe processors, the processors operable when executing the instructionsto: access a social graph comprising a plurality of nodes and aplurality of edges connecting the nodes, each of the edges between twoof the nodes representing a single degree of separation between them,the nodes comprising: a first node corresponding to a first userassociated with an online social network; and a plurality of secondnodes that each correspond to a concept or a second user associated withthe online social network; receive from the first user an unstructuredtext query comprising one or more n-grams; identify one or more of thesecond nodes, each of the identified second nodes corresponding to oneor more of the n-grams; identify one or more of the edges, each of theidentified edges being connected to at least one of the identifiedsecond nodes, each of the identified edges corresponding to one or moreof the n-grams; and generate one or more structured queries that eachcomprise references to one or more of the identified second nodes andone or more of the identified edges. 17-30. (canceled)
 31. One or morecomputer-readable non-transitory storage media embodying software thatis operable when executed to: access a social graph comprising aplurality of nodes and a plurality of edges connecting the nodes, eachof the edges between two of the nodes representing a single degree ofseparation between them, the nodes comprising: a first nodecorresponding to a first user associated with an online social network;and a plurality of second nodes that each correspond to a concept or asecond user associated with the online social network; receive from thefirst user an unstructured text query comprising one or more n-grams;identify one or more of the second nodes, each of the identified secondnodes corresponding to one or more of the n-grams; identify one or moreof the edges, each of the identified edges being connected to at leastone of the identified second nodes, each of the identified edgescorresponding to one or more of the n-grams; and generate one or morestructured queries that each comprise references to one or more of theidentified second nodes and one or more of the identified edges.
 32. Themethod of claim 1, wherein receiving from the first user theunstructured text query comprises receiving one or more characters of acharacter string as the first user at a client system enters thecharacter string into a graphical user interface.
 33. The method ofclaim 32, wherein the graphical user interface comprises a query field,and wherein the character string is entered by the first user into thequery field.
 34. The method of claim 1, further comprising sending oneor more of the structured queries for presentation to the first user.35. The method of claim 34, further comprising presenting the one ormore sent structured queries to the first user, wherein, for each sentstructured query, one or more of the references of the sent structuredquery is highlighted as presented to indicate the reference correspondsto an identified second node or an identified edge.
 36. The method ofclaim 1, wherein the unstructured text query is received from a clientsystem associated with the first user.
 37. The method of claim 1,wherein the unstructured text query is received from a third-partysystem via a first call through an application programming interfaceassociated with the online social network.
 38. The method of claim 37,further comprising sending one or more of the structure queries to thethird-party system in response to the first call.
 39. The method ofclaim 38, further comprising receiving a selection of one of thestructured queries from the third-party system via a second call throughthe application programming interface.
 40. The method of claim 39,further comprising sending search results corresponding to the selectionof one of the structured queries to the third-party system in responseto the second call.
 41. The method of claim 1, further comprisingsending, to a third-party system, search results corresponding to one ofthe structured queries in response to receiving from the third-partysystem a call through an application programming interface associatedwith the online social network.
 42. The method of claim 1, wherein theunstructured text query is received from a third-party system via acommunication channel associated with the online social network.